[Toybox] [PATCH] segfault during option parsing

Sameer Pradhan sameer.p.pradhan at gmail.com
Tue Jul 7 05:11:47 PDT 2015


Hi Rob and List,

I faced a situation where the group option parsing logic causes a Segfault.
The scenario is as follows:

Like in compress.c:
USE_COMPRESS(NEWTOY(compress, "zcd9lrg[-cd][!zgLr]",
TOYFLAG_USR|TOYFLAG_BIN))

The  '__L__' option is not in the argument list where as in the
option group has '__L__' option.

If CFG_TOYBOX_DEBUG is enabled the current implementation hits the
error_exit() otherwise it's trying to access opt->c which causes the
segfault.


Please find the patch for the same.



-- 
Thanks & Regards
Sameer Prakash Pradhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20150707/bd34cee7/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: args.c.patch
Type: application/octet-stream
Size: 612 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20150707/bd34cee7/attachment-0004.obj>


More information about the Toybox mailing list