[asterisk-commits] tilghman: branch 1.4 r62692 - in /branches/1.4: ./ channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 2 10:43:48 MST 2007


Author: tilghman
Date: Wed May  2 12:43:48 2007
New Revision: 62692

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62692
Log:
Merged revisions 62691 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r62691 | tilghman | 2007-05-02 12:38:16 -0500 (Wed, 02 May 2007) | 4 lines

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.4/   (props changed)
    branches/1.4/channels/chan_iax2.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=62692&r1=62691&r2=62692
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Wed May  2 12:43:48 2007
@@ -6569,6 +6569,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 && thread->buf[res - 1] != '\0') {
+			if (res < sizeof(thread->buf))
+				thread->buf[res++] = '\0';
+			else /* Trims one character from the text message, but that's better than overwriting the end of the buffer. */
+				thread->buf[res - 1] = '\0';
 		}
 		f.datalen = res - sizeof(*fh);
 



More information about the asterisk-commits mailing list