[asterisk-dev] [Code Review] 3599: menuselect fails to read config when all resource modules are disabled

Corey Farrell reviewboard at asterisk.org
Fri Jun 6 22:07:35 CDT 2014



> On June 6, 2014, 10:41 p.m., Matt Jordan wrote:
> > /trunk/menuselect.c, lines 1258-1260
> > <https://reviewboard.asterisk.org/r/3599/diff/1/?file=59389#file59389line1258>
> >
> >     As much as I'd like to hit 'Ship It!', I'm pretty sure this is going blow up people trying to use menuselect on embedded systems.
> >     
> >     8k is a pretty big stack allocation...
> >     
> >     We're using fgets here to parse out the file - what line length is exceeding 2k in that file? 
> >     
> >     Another option here would be to allocate a buffer on the heap, read chunks in 2k sizes, add the contents to the buffer, and grow + add until we've read a full line.
> >
> 
> rmudgett wrote:
>     Might I ask why menuselect would be run on an embedded system and not by the development machine that compiles Asterisk?

The line for "MENUSELECT_RES=" is 2260 bytes long if you disable all resource modules.  I originally increased to 4k, but then thought why not make it more future proof.  Would it be ok if we go with 4kb or 8kb malloc instead of stack variable?  If a system can't do an 8kb malloc in menuselect I don't think it can run asterisk.


- Corey


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


On June 6, 2014, 2:59 p.m., Corey Farrell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3599/
> -----------------------------------------------------------
> 
> (Updated June 6, 2014, 2:59 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-23830
>     https://issues.asterisk.org/jira/browse/ASTERISK-23830
> 
> 
> Repository: Menuselect
> 
> 
> Description
> -------
> 
> menuselect reads config using a char buf[2048].  This is too small if all resource modules are disabled - causing the last modules listed to be re-enabled.  This change expands the buffer to 8192.
> 
> 
> Diffs
> -----
> 
>   /trunk/menuselect.c 1157 
> 
> Diff: https://reviewboard.asterisk.org/r/3599/diff/
> 
> 
> Testing
> -------
> 
> make menuselect, disabled all resource modules, saved and went back in to verify all resource modules were still disabled.
> 
> 
> Thanks,
> 
> Corey Farrell
> 
>

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


More information about the asterisk-dev mailing list