Index: chan_sip.c =================================================================== --- chan_sip.c (revision 29050) +++ chan_sip.c (working copy) @@ -12121,10 +12121,12 @@ ast_log(LOG_WARNING, "Recv error: %s\n", strerror(errno)); return 1; } - if (option_debug && res == sizeof(req.data)) + if (option_debug && res == sizeof(req.data)) { ast_log(LOG_DEBUG, "Received packet exceeds buffer. Data is possibly lost\n"); - - req.data[res] = '\0'; + /* req.data[res] there would write after end of buffer */ + req.data[sizeof(req.data)-1] = '\0'; + } else + req.data[res] = '\0'; req.len = res; if(sip_debug_test_addr(&sin)) /* Set the debug flag early on packet level */ ast_set_flag(&req, SIP_PKT_DEBUG);