From: Dmitry Stogov Date: Thu, 12 Oct 2017 08:54:40 +0000 (+0300) Subject: Small improvement with zend_memnstr (tianhe1986) X-Git-Tag: php-7.3.0alpha1~1285 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4960c41e1f6345d8f0200b287eeba84117e1b511;p=php Small improvement with zend_memnstr (tianhe1986) --- diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index b2f53785bd..412062342c 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -172,7 +172,7 @@ zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const while (p <= end) { if ((p = (const char *)memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) { - if (!memcmp(needle, p, needle_len-1)) { + if (!memcmp(needle+1, p+1, needle_len-2)) { return p; } }