Author: sayer
Date: 2009-10-15 16:00:59 +0200 (Thu, 15 Oct 2009)
New Revision: 1544

Modified:
   trunk/core/plug-in/sipctrl/trans_layer.cpp
Log:
null-terminate string before trying to parse it. patch by Robert Szokovacs


Modified: trunk/core/plug-in/sipctrl/trans_layer.cpp
===================================================================
--- trunk/core/plug-in/sipctrl/trans_layer.cpp  2009-10-14 18:14:49 UTC (rev 
1543)
+++ trunk/core/plug-in/sipctrl/trans_layer.cpp  2009-10-15 14:00:59 UTC (rev 
1544)
@@ -644,7 +644,7 @@
 
     // Allocate new message
     sip_msg* p_msg = new sip_msg();
-    p_msg->buf = new char[request_len];
+    p_msg->buf = new char[request_len+1];
     p_msg->len = request_len;
 
     // generate it
@@ -663,9 +663,9 @@
     if(msg->body.len){
        memcpy(c,msg->body.s,msg->body.len);
 
-       // Not needed by now as the message is finished
-       //c += body.len;
+       c += msg->body.len;
     }
+    *c++ = '\0';
 
     // and parse it
     char* err_msg=0;

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to