GNOME Bugzilla – Bug 344222
not checking results from strtol correctly
Last modified: 2006-06-11 09:14:15 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.
Created attachment 66943 [details] [review] fix error checking on strtol() this is also needed for the XML-RPC version of bug buddy
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...)
I doubt it as it is not documented, but that's another bug I've been meaning to file :-)