mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Check if given string is long enough in zend_*_strtod
This commit is contained in:
parent
e7d106f11d
commit
fa7c07b10c
1 changed files with 15 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue