com php-src: Better fix for bug #72135: ext/standard/html.c
| From: | Stanislav Malyshev | Date: | Tue, 24 May 2016 22:52:15 +0000 |
| Subject: | com php-src: Better fix for bug #72135: ext/standard/html.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92190@lists.php.net to get a copy of this message | ||
Commit: e9559131152ab0fa89737db11ebe8f43e1435b96
Author: Stanislav Malyshev <stas@php.net> Tue, 24 May 2016 15:52:15 -0700
Parents: 7a1aac3343af85b4af4df5f8844946eaa27394ab
Branches: PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e9559131152ab0fa89737db11ebe8f43e1435b96
Log:
Better fix for bug #72135
Bugs:
https://bugs.php.net/72135
Changed paths:
M ext/standard/html.c
Diff:
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 81d8aff..c5fd4b8 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1423,6 +1423,11 @@ encode_amp:
}
replaced[len] = '\0';
*newlen = len;
+ if(len > INT_MAX) {
+ zend_error_noreturn(E_ERROR, "Escaped string is too long");
+ efree(replaced);
+ return NULL;
+ }
return replaced;
}
@@ -1444,10 +1449,6 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
}
replaced = php_escape_html_entities_ex(str, str_len, &new_len, all, (int) flags, hint_charset,
double_encode TSRMLS_CC);
- if (new_len > INT_MAX) {
- efree(replaced);
- RETURN_FALSE;
- }
RETVAL_STRINGL(replaced, (int)new_len, 0);
}
/* }}} */