looking at

changeset 1626:89384d54d49a tip

Teach factor to accept whitespace separated arguments (reported by
Robert Thompson). (The diff looks bigger than it is because of
reindenting.)

i noticed that the strtol error check is incorrect. you need to set
errno to 0 before and check it afterwards because the strto* family
set errno rather than reject digits that would cause them to overflow
or underflow. for example:

$ ./toybox factor 29497513910652490397
9223372036854775807: 7 7 73 127 337 92737 649657

a quick grep -A2 suggests this pattern is repeated in lots of other
places. get_w_p in printf.c is fine, for example. show_iface in
ifconfig.c is close, but the error reporting will be wrong because
errno isn't tested until after the loop, at which point buf will no
longer point to the bad input. all the calls in lib.c are wrong.
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to