[asterisk-commits] tilghman: branch 1.2 r62691 -
/branches/1.2/channels/chan_iax2.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 2 10:38:17 MST 2007
Author: tilghman
Date: Wed May 2 12:38:16 2007
New Revision: 62691
URL: http://svn.digium.com/view/asterisk?view=rev&rev=62691
Log:
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.
Modified:
branches/1.2/channels/chan_iax2.c
Modified: branches/1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_iax2.c?view=diff&rev=62691&r1=62690&r2=62691
==============================================================================
--- branches/1.2/channels/chan_iax2.c (original)
+++ branches/1.2/channels/chan_iax2.c Wed May 2 12:38:16 2007
@@ -6731,6 +6731,13 @@
ast_log(LOG_WARNING, "midget packet received (%d of %zd min)\n", res, sizeof(*fh));
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);
More information about the asterisk-commits
mailing list