eap: Reset errno before calling strtoul() to parse EAP type
Reset errno to 0 before calling strtoul() since it sets errno only on error cases. So the following test fails even on correct conversions if errno had a value != 0. Fixes #2506.
This commit is contained in:
committed by
Tobias Brunner
parent
3232cf68b9
commit
a8e940ade2
@@ -157,6 +157,7 @@ eap_vendor_type_t *eap_vendor_type_from_string(char *str)
|
|||||||
type = eap_type_from_string(part);
|
type = eap_type_from_string(part);
|
||||||
if (!type)
|
if (!type)
|
||||||
{
|
{
|
||||||
|
errno = 0;
|
||||||
type = strtoul(part, &end, 0);
|
type = strtoul(part, &end, 0);
|
||||||
if (*end != '\0' || errno)
|
if (*end != '\0' || errno)
|
||||||
{
|
{
|
||||||
@@ -166,6 +167,7 @@ eap_vendor_type_t *eap_vendor_type_from_string(char *str)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
vendor = strtoul(part, &end, 0);
|
vendor = strtoul(part, &end, 0);
|
||||||
if (*end != '\0' || errno)
|
if (*end != '\0' || errno)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user