]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix the possibility of writing one byte past the end of a buffer.
authorRussell Bryant <russell@russellbryant.com>
Sat, 20 May 2006 19:50:41 +0000 (19:50 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sat, 20 May 2006 19:50:41 +0000 (19:50 +0000)
(issue #7189, Mithraen)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@29052 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index f3d93f52ad948048f2dc568ede9687a36d8c38d2..8719be134b0e6aab3aacb9e6d6c4d8adc568f7f0 100644 (file)
@@ -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);