[asterisk-commits] pkiefer: branch 11 r376822 - /branches/11/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 29 11:17:17 CST 2012


Author: pkiefer
Date: Thu Nov 29 11:17:11 2012
New Revision: 376822

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376822
Log:
Fix chan_sip websocket payload handling

Websocket by default doesn't return an ast_str for the payload received. When 
converting it to an ast_str on chan_sip the last character was being omitted, 
because ast_str functions expects that the given length includes the trailing 
0x00. payload_len only has the actual string length without counting the 
trailing zero.

For most cases this passed unnoticed as most of SIP messages ends with \r\n.

(closes issue ASTERISK-20745)
Reported by: Iñaki Baz Castillo
Review: https://reviewboard.asterisk.org/r/2219/


Modified:
    branches/11/channels/chan_sip.c

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=376822&r1=376821&r2=376822
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Thu Nov 29 11:17:11 2012
@@ -2593,7 +2593,7 @@
 		if (opcode == AST_WEBSOCKET_OPCODE_TEXT || opcode == AST_WEBSOCKET_OPCODE_BINARY) {
 			struct sip_request req = { 0, };
 
-			if (!(req.data = ast_str_create(payload_len))) {
+			if (!(req.data = ast_str_create(payload_len + 1))) {
 				goto end;
 			}
 




More information about the asterisk-commits mailing list