[asterisk-dev] [Code Review] Fix r374905 misuse of strdupa

rmudgett reviewboard at asterisk.org
Tue Oct 16 16:05:35 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2162/#review7281
-----------------------------------------------------------

Ship it!


Looks good to me.
A couple optional tweaks to eliminate some strlen() calls.


/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/2162/#comment14055>

    This could be:
    message_len = ast_str_strlen(*request)



/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/2162/#comment14057>

    This can be calculated rather than using a call to strlen().
    body_len = message_len - (body - message)


- rmudgett


On Oct. 13, 2012, 1:43 a.m., wdoekes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2162/
> -----------------------------------------------------------
> 
> (Updated Oct. 13, 2012, 1:43 a.m.)
> 
> 
> Review request for Asterisk Developers and Mark Michelson.
> 
> 
> Summary
> -------
> 
> I was a bit quick on the ship-it there ;)
> Those strdupa's are far from safe from direct user input.
> 
> Here's a fix, which happens to slightly faster too.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 374930 
> 
> Diff: https://reviewboard.asterisk.org/r/2162/diff
> 
> 
> Testing
> -------
> 
> Got asterisk to crash easily before patch. No crash after. Mark's test from r2123 still completes with 0 errors.
> 
> 
> Thanks,
> 
> wdoekes
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121016/5374ad04/attachment.htm>


More information about the asterisk-dev mailing list