diff options
author | jeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-01-11 18:50:46 +0000 |
---|---|---|
committer | jeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-01-11 18:50:46 +0000 |
commit | 38fe645c6ddeacbe2ffa7751592ad79551f2b121 (patch) | |
tree | eada4c665697424ec01e131d60d84c9339888bb4 | |
parent | 401e8ac23fd3660b24dbb7f5319a846f13eca96c (diff) |
check buffer for possible overflow. Thanks Corydon76 Bug #788
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1951 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_sip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8e963951a..fc051d466 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4114,7 +4114,11 @@ static int get_msg_text(char *buf, int len, struct sip_request *req) y = 0; for (x=0;x<req->lines;x++) { strncat(buf, req->line[x], y); - strcat(buf, "\n"); + y -= strlen(req->line[x]) + 1; + if (y < 0) + y = 0; + if (y != 0) + strcat(buf, "\n"); } return 0; } |