com php-src: Fixed bug #75575: Zend/zend_operators.c
| From: | Nikita Popov | Date: | Tue, 28 Nov 2017 22:10:50 +0000 |
| Subject: | com php-src: Fixed bug #75575: Zend/zend_operators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100426@lists.php.net to get a copy of this message | ||
Commit: 5dc6392d257fa8a4c3a8938e9e0e36ae44a6834e
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 28 Nov 2017 23:10:50 +0100
Parents: 4e0b3c0c4c27cddcff6013a2c408597bbe87d2d5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5dc6392d257fa8a4c3a8938e9e0e36ae44a6834e
Log:
Fixed bug #75575
These functions are never called with needle longer than haystack,
but it makes sense to explicitly check for this, especially as we
already perform a check for empty haystack anyway, which is
naturally subsumed by a haystack_len < needle_len check.
Bugs:
https://bugs.php.net/75575
Changed paths:
M Zend/zend_operators.c
Diff:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 540f979..cad8d1d 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -3049,7 +3049,7 @@ ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const
c
register size_t i;
register const char *p;
- if (needle_len == 0 || (end - haystack) == 0) {
+ if (needle_len == 0 || (end - haystack) < needle_len) {
return NULL;
}
@@ -3083,7 +3083,7 @@ ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack,
const
register size_t i;
register const char *p;
- if (needle_len == 0 || (end - haystack) == 0) {
+ if (needle_len == 0 || (end - haystack) < needle_len) {
return NULL;
}