From: tianhe1986 Date: Thu, 12 Oct 2017 14:46:26 +0000 (+0800) Subject: `memcmp` begins from the second char. X-Git-Tag: php-7.3.0alpha1~1281^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6519cb69da5b0975d646e18ad17cd184771696a;p=php `memcmp` begins from the second char. Signed-off-by: tianhe1986 --- diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 412062342c..b6e16c3430 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -230,7 +230,7 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, char do { if ((p = (const char *)zend_memrchr(haystack, *needle, (p - haystack) + 1)) && ne == p[needle_len-1]) { - if (!memcmp(needle, p, needle_len - 1)) { + if (!memcmp(needle + 1, p + 1, needle_len - 2)) { return p; } }