You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function evcpe_type_validate() cannot handle the UINT_MAX 4294967295 number.
In order to reproduce, try to make a call to evcpe_attr_set() on an unsignedInt
pareameter. The following message will be displayed:
not a positive integer: -1.
I've patched the function in order to use the strtoul() but with more check as
suggested in one of the site that I've visited:
int evcpe_strtoul(const char *str, int base, unsigned long *ul)
{
char *bad_char = NULL;
unsigned long num = 0;
if (!str || !ul || (base > 36) || (base < 0))
{
return -1;
}
errno = 0;
num = strtoul(str, &bad_char, base);
if(ERANGE == errno)
{
if((0 == num) && (str == bad_char))
{
evcpe_error(__func__, "cannot convert the string: %s", str);
}
else if(ULONG_MAX == num)
{
evcpe_error(__func__, "an overflow has been detected");
}
}
else if((0 == errno) && ((NULL != bad_char) && ('\0' == *bad_char)))
{
*ul = num;
return 0;
}
evcpe_error(__func__, "cannot convert the string: %s", str);
return -1;
}
Original issue reported on code.google.com by [email protected] on 29 Aug 2011 at 1:18
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 29 Aug 2011 at 1:18The text was updated successfully, but these errors were encountered: