diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fd5971e0f3..e1727dea98 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3720,9 +3720,13 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, cha static int get_msg_text(char *buf, int len, struct sip_request *req) { int x; + int y; strcpy(buf, ""); + y = len - strlen(buf) - 5; + if (y < 0) + y = 0; for (x=0;xlines;x++) { - strncat(buf, req->line[x], len - strlen(buf) - 5); + strncat(buf, req->line[x], y); strcat(buf, "\n"); } return 0;