Issue 9638 - if a text frame is sent with no terminating NULL through a bridged

IAX connection, the remote end will receive garbage characters tacked onto the
end.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@62691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2
Tilghman Lesher 19 years ago
parent c8a90488d6
commit 9b71a5799b

@ -6732,6 +6732,13 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
/* Ensure text frames are NULL-terminated */
if (f.frametype == AST_FRAME_TEXT && buf[res - 1] != '\0') {
if (res < sizeof(buf))
buf[res++] = '\0';
else /* Trims one character from the text message, but that's better than overwriting the end of the buffer. */
buf[res - 1] = '\0';
}
f.datalen = res - sizeof(*fh);
/* Handle implicit ACKing unless this is an INVAL, and only if this is

Loading…
Cancel
Save