mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Check if given string is long enough in zend_*_strtod
This commit is contained in:
parent
dd06894b56
commit
0beb0e7056
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user