<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi, Ramachandran!<br>
<br>
The print_buff buffer is declared with length MAX_CONTENT_TYPE_LEN
-> 64. Writing more than 64 bytes will lead to a buffer overflow,
probably followed by a crash.<br>
If you want to suppor longer CallIDs, just increase the size of the
buffer, or allocate the buffer with a size large enought to fit your
callid length.<br>
<br>
Best regards,<br>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 01/17/2017 11:13 PM, Ramachandran,
Agalya (Contractor) wrote:<br>
</div>
<blockquote
cite="mid:e9058c408d5a45ca817a93ba82a1dc53@COPDCEX28.cable.comcast.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:black">Hi Liviu, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Found the exact
issue what causes the crash.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">In
start_async_http_req, under case PUT/POST, we have the
following code
</span><span style="color:blue">blue color </span><span
style="color:black">by default.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">But for my
project scenario, I need to add call-id header too here,
including that code
</span><span style="color:red">in red color </span><span
style="color:black">for your reference.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">if (req_ctype) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">
sprintf(print_buff, "Content-Type: %s", req_ctype);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">
header_list = curl_slist_append(header_list, print_buff);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">
</span><span style="color:red">sprintf(print_buff, "Call-Id:
%s", instanceId);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:red">
header_list = curl_slist_append(header_list, print_buff);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">
w_curl_easy_setopt(handle, CURLOPT_HTTPHEADER, header_list);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">If I try by
removing the Call-Id header in the curl-slist, then it works
perfectly fine in case of POST as well as PUT.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">How can I
overcome this situation? Your guidance would help me a lot.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Regards,<br>
Agalya<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Users
[<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Ramachandran, Agalya (Contractor)<br>
<b>Sent:</b> Tuesday, January 17, 2017 3:58 PM<br>
<b>To:</b> OpenSIPS users mailling list
<a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>; Liviu Chircu
<a class="moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org"><liviu@opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] async- issues- 2.2.2<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:blue">Hi, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Another
information may help you to find this issue.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Am changing the
“req_body” in the rest_methods.c, as per the REST API server
is expecting the payload value.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">If I change this
“req_body” in <b>REST_POST</b> as well, and if the
<b>Call-Id length is > 56</b>, it crashes in <b>the POST
call too</b>. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Regards,<br>
Agalya<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Users [<a
moz-do-not-send="true"
href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Ramachandran, Agalya (Contractor)<br>
<b>Sent:</b> Tuesday, January 17, 2017 3:03 PM<br>
<b>To:</b> OpenSIPS users mailling list <<a
moz-do-not-send="true"
href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>>;
Liviu Chircu <<a moz-do-not-send="true"
href="mailto:liviu@opensips.org">liviu@opensips.org</a>><br>
<b>Subject:</b> [OpenSIPS-Users] async- issues- 2.2.2<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:blue">Hi Liviu/team, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">When I try to do
an asynchronous REST_PUT call in OpenSIPS 2.2.2, I see the
below observance and issues.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">All the calls are
made from sipp client.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<table class="MsoNormalTable" style="border-collapse:collapse"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:31.1pt;border:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="41">
<p class="MsoNormal"><b><span style="color:blue">No<o:p></o:p></span></b></p>
</td>
<td style="width:139.5pt;border:solid windowtext
1.0pt;border-left:none;padding:0in 5.4pt 0in 5.4pt"
valign="top" width="186">
<p class="MsoNormal"><b><span style="color:blue">Test
Scenario <o:p></o:p></span></b></p>
</td>
<td style="width:296.9pt;border:solid windowtext
1.0pt;border-left:none;padding:0in 5.4pt 0in 5.4pt"
valign="top" width="396">
<p class="MsoNormal"><b><span style="color:blue">Result/observation<o:p></o:p></span></b></p>
</td>
</tr>
<tr>
<td style="width:31.1pt;border:solid windowtext
1.0pt;border-top:none;padding:0in 5.4pt 0in 5.4pt"
valign="top" width="41">
<p class="MsoNormal"><span style="color:blue">1.<o:p></o:p></span></p>
</td>
<td
style="width:139.5pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="186">
<p class="MsoNormal"><span style="color:blue">Call-Id
length < 50<o:p></o:p></span></p>
</td>
<td
style="width:296.9pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="396">
<p class="MsoNormal"><span style="color:blue">Works
perfectly fine<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="width:31.1pt;border:solid windowtext
1.0pt;border-top:none;padding:0in 5.4pt 0in 5.4pt"
valign="top" width="41">
<p class="MsoNormal"><span style="color:blue">2<o:p></o:p></span></p>
</td>
<td
style="width:139.5pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="186">
<p class="MsoNormal"><span style="color:blue">Call-Id
length >54 and < 56<o:p></o:p></span></p>
</td>
<td
style="width:296.9pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="396">
<p class="MsoNormal"><span style="color:blue">No crash
observed. But error in curl_multiperform<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="width:31.1pt;border:solid windowtext
1.0pt;border-top:none;padding:0in 5.4pt 0in 5.4pt"
valign="top" width="41">
<p class="MsoNormal"><span style="color:blue">3. <o:p></o:p></span></p>
</td>
<td
style="width:139.5pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="186">
<p class="MsoNormal"><span style="color:blue">Call-Id
length > 56 <o:p></o:p></span></p>
</td>
<td
style="width:296.9pt;border-top:none;border-left:none;border-bottom:solid
windowtext 1.0pt;border-right:solid windowtext
1.0pt;padding:0in 5.4pt 0in 5.4pt" valign="top"
width="396">
<p class="MsoNormal"><span style="color:blue">Opensips
crashes at liburl. <o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Please find the
details for test 2 and test 3.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">I have tested with
REST_POST with case 3, I didn’t observe any crashes.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Please let me know
what could cause this issue and how can I fix this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:blue">Test2:<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:blue"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><span style="color:#C00000">Jan 17 18:23:13
/usr/local/sbin/opensips[18554]:
ERROR:rest_client:start_async_http_req: curl_multi_perform:
Invalid multi handle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">Jan 17
18:23:13 /usr/local/sbin/opensips[18554]:
ERROR:rest_client:start_async_http_req:
curl_multi_remove_handle: Invalid multi handle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:blue">Test 3:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">(gdb) bt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#0
0x00007f370bccb9bb in curl_multi_add_handle () from
/lib64/libcurl.so.4<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#1
0x00007f370bf05521 in start_async_http_req
(msg=msg@entry=0x7f374db14270,
method=method@entry=REST_CLIENT_PUT,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
url=0x7f374dad8178 "<a moz-do-not-send="true"
href="http://url">http://url</a>", req_body=<optimized
out>,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
req_ctype=<optimized out>,
out_handle=out_handle@entry=0x7f374db204e0,
body=body@entry=0x7f374db204e8, ctype=0x7f374db204f8)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000"> at
rest_methods.c:227<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#2
0x00007f370bf0e2ca in w_async_rest_put (msg=0x7f374db14270,
resume_f=0x7ffc6f551680, resume_param=0x7ffc6f551690,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
gp_url=<optimized out>, gp_body=<optimized out>,
gp_ctype=<optimized out>, body_pv=0x7f374daf5510 "N",<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
ctype_pv=0x7f374daf55a8 "N", code_pv=0x7f374daf5670 "N") at
rest_client.c:579<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#3
0x00007f370d24920f in t_handle_async (msg=0x7f374db14270,
a=0x7f374dad8508, resume_route=<optimized out>) at
async.c:240<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#4
0x000000000042d724 in do_action (a=a@entry=0x7f374dad8680,
msg=msg@entry=0x7f374db14270) at action.c:1863<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#5
0x00000000004341cc in run_action_list (a=<optimized
out>, msg=0x7f374db14270) at action.c:172<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#6
0x0000000000430769 in do_action (a=a@entry=0x7f374dad8760,
msg=msg@entry=0x7f374db14270) at action.c:1108<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#7
0x000000000043454d in run_action_list (msg=<optimized
out>, a=<optimized out>) at action.c:172<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#8 run_actions
(a=<optimized out>, msg=0x7f374db14270) at
action.c:137<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#9
0x000000000042f8d7 in do_action (a=a@entry=0x7f374dad6b58,
msg=msg@entry=0x7f374db14270) at action.c:745<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#10
0x0000000000434393 in run_action_list (msg=<optimized
out>, a=<optimized out>) at action.c:172<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#11 run_actions
(msg=0x7f374db14270, a=<optimized out>) at
action.c:137<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#12
run_top_route (a=<optimized out>,
msg=msg@entry=0x7f374db14270) at action.c:204<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#13
0x000000000043bcba in receive_msg (<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
buf=0x858c20 <buf.8277> "INVITE
<a moz-do-not-send="true"
href="sip:+19084904567@10.10.10.05060">sip:+19084904567@10.10.10.05060</a>
SIP/2.0\r\nTo: <<a moz-do-not-send="true"
href="sip:+19084904567@test.comcast.net;user=phone">sip:+19084904567@test.comcast.net;user=phone</a>>\r\nFrom:
\"test PA\"<<a moz-do-not-send="true"
href="sip:+16507083454@10.0.0.1:32004;user=phone;isup-oli=00">sip:+16507083454@10.0.0.1:32004;user=phone;isup-oli=00</a>>;"...,
len=<optimized out>,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">
rcv_info=rcv_info@entry=0x7ffc6f552c70,
existing_context=existing_context@entry=0x0) at
receive.c:208<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#14
0x00000000005b0b03 in udp_read_req (si=<optimized
out>, bytes_read=<optimized out>) at
net/proto_udp/proto_udp.c:192<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#15
0x000000000059b960 in handle_io (idx=<optimized out>,
event_type=<optimized out>, fm=<optimized out>)
at net/net_udp.c:259<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#16
io_wait_loop_epoll (h=<optimized out>, t=<optimized
out>, repeat=<optimized out>) at
net/../io_wait_loop.h:225<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#17
udp_rcv_loop (si=si@entry=0x7f374dacb6c8) at
net/net_udp.c:308<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#18
0x000000000059ce88 in udp_start_processes
(chd_rank=chd_rank@entry=0x845830 <chd_rank.11028>,
startup_done=startup_done@entry=0x0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000"> at
net/net_udp.c:372<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#19
0x0000000000419f50 in main_loop () at main.c:671<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#C00000">#20 main
(argc=<optimized out>, argv=<optimized out>) at
main.c:1261<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Regards,<br>
Agalya<o:p></o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>