[asterisk-commits] tilghman: trunk r62693 - in /trunk: ./ channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 2 10:49:37 MST 2007


Author: tilghman
Date: Wed May  2 12:49:36 2007
New Revision: 62693

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

................
r62692 | tilghman | 2007-05-02 12:43:48 -0500 (Wed, 02 May 2007) | 12 lines

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:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

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

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=62693&r1=62692&r2=62693
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed May  2 12:49:36 2007
@@ -6821,6 +6821,13 @@
 			ast_log(LOG_WARNING, "midget packet received (%d of %d min)\n", res, (int) 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