After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344222 - not checking results from strtol correctly
not checking results from strtol correctly
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: API
2.2.x
Other Linux
: Normal major
: ---
Assigned To: Dan Winship
Dan Winship
Depends on:
Blocks: 133765
 
 
Reported: 2006-06-07 23:25 UTC by Brent Smith (smitten)
Modified: 2006-06-11 09:14 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
fix error checking on strtol() (769 bytes, patch)
2006-06-07 23:26 UTC, Brent Smith (smitten)
none Details | Review

Description Brent Smith (smitten) 2006-06-07 23:25:11 UTC
I think the soup_xmlrpc_value_get_int() function does not check the results of strtol() correctly.

From the manpage for strtol(3):

long int
strtol(const char *nptr, char **endptr, int base);

If endptr is not NULL, strtol() stores the address of the first invalid character in *endptr.  If there were no digits  at  all, strtol() stores the original value of nptr in *endptr (and returns 0).  In particular, if *nptr is not ‘\0’ but **endptr is ‘\0’ on return, the entire string is valid.

therefore we should check "*tail" for '\0' and not "tail"

patch follows.
Comment 1 Brent Smith (smitten) 2006-06-07 23:26:00 UTC
Created attachment 66943 [details] [review]
fix error checking on strtol()

this is also needed for the XML-RPC version of bug buddy
Comment 2 Dan Winship 2006-06-08 12:42:07 UTC
committed (and fixed the same bug in get_double and get_boolean as well).

(hm... i guess this answers the question of whether or not anyone is using
this code...)
Comment 3 Brent Smith (smitten) 2006-06-08 19:20:46 UTC
I doubt it as it is not documented, but that's another bug I've been meaning to file :-)