aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 19:50:41 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 19:50:41 +0000
commit1a43795f60755de8d0c24a1cf9df5ceb83a214a7 (patch)
tree39fb8f0363789c0e6eea48ad9f3cdf1ffc24799d /channels
parent6f39f98a0e1784c8eb4ad967a3feb9f3cfdd224e (diff)
fix the possibility of writing one byte past the end of a buffer.
(issue #7189, Mithraen) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@29052 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f3d93f52a..8719be134 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11215,8 +11215,9 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
}
if (res == sizeof(req.data)) {
ast_log(LOG_DEBUG, "Received packet exceeds buffer. Data is possibly lost\n");
- }
- req.data[res] = '\0';
+ req.data[sizeof(req.data) - 1] = '\0';
+ } else
+ req.data[res] = '\0';
req.len = res;
if(sip_debug_test_addr(&sin))
ast_set_flag(&req, SIP_PKT_DEBUG);