[saml2] when parsing short numbers reinitialize errno

This commit is contained in:
Benjamin Dauvergne 2011-01-04 16:37:34 +01:00
parent 03b15e3886
commit 2b90dcd503
1 changed files with 3 additions and 1 deletions

View File

@ -127,8 +127,10 @@ xsdIsFalse(xmlChar *value)
static gboolean
xsdUnsignedShortParse(xmlChar *value, int *out) {
int l = strtol((char*)value, NULL, 10);
int l = 0;
errno = 0;
l = strtol((char*)value, NULL, 10);
if (((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE) ||
errno == EINVAL || l < 0 || l >= 65535) {
return FALSE;