[asterisk-dev] [Code Review] 4529: clang compiler warning: -Wno-sometimes-uninitialized

Matt Jordan reviewboard at asterisk.org
Thu Mar 26 20:11:06 CDT 2015


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



/branches/13/pbx/pbx_config.c
<https://reviewboard.asterisk.org/r/4529/#comment25502>

    So, dup'ing things on the stack here in a nested loop is actually quite dangerous. Unlike a local variable with scope within the loop block, a variable that is allocated with one of the alloca methods (which strdupa should fall into) does not have its memory reclaimed when it loses block scope. It is only reclaimed when the stack frame returns.
    
    As such, this change could overrun the stack.
    
    Since escaped is a char *, I'd go ahead and strdup it here, and free it before the loop continues.


- Matt Jordan


On March 26, 2015, 1:03 p.m., Diederik de Groot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4529/
> -----------------------------------------------------------
> 
> (Updated March 26, 2015, 1:03 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24917
>     https://issues.asterisk.org/jira/browse/ASTERISK-24917
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> clang's static analyzer will throw quite a number warnings / errors during compilation, some of which can be very helpfull in finding corner-case bugs\nclang compiler warning:-Wno-sometimes-uninitialized
> 
> 
> Diffs
> -----
> 
>   /branches/13/pbx/pbx_config.c 433444 
> 
> Diff: https://reviewboard.asterisk.org/r/4529/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Diederik de Groot
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150327/ff1dad05/attachment.html>


More information about the asterisk-dev mailing list