Check if given string is long enough in zend_*_strtod

This commit is contained in:
David Soria Parra 2011-07-27 14:17:45 +00:00
parent dd06894b56
commit 0beb0e7056

View File

@ -2585,6 +2585,11 @@ ZEND_API double zend_hex_strtod(const char *str, const char **endptr)
int any = 0;
double value = 0;
if (strlen(str) < 2) {
*endptr = str;
return 0.0;
}
if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) {
s += 2;
}
@ -2618,6 +2623,11 @@ ZEND_API double zend_oct_strtod(const char *str, const char **endptr)
double value = 0;
int any = 0;
if (strlen(str) < 1) {
*endptr = str;
return 0.0;
}
/* skip leading zero */
s++;
@ -2646,6 +2656,11 @@ ZEND_API double zend_bin_strtod(const char *str, const char **endptr)
double value = 0;
int any = 0;
if (strlen(str) < 2) {
*endptr = str;
return 0.0;
}
if ('0' == *s && ('b' == s[1] || 'B' == s[1])) {
s += 2;
}