From 80571d6f967c879a5f1c457fbc51092df5d131a4 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 19 Dec 2017 12:14:50 +0100 Subject: [PATCH] Avoid strlen call --- ext/opcache/zend_accelerator_blacklist.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index 78df0e476d..46d50cf96d 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -170,7 +170,6 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) i++; } *p++ = ')'; - *p++ = '\0'; it = (zend_regexp_list*)malloc(sizeof(zend_regexp_list)); if (!it) { @@ -179,7 +178,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) } it->next = NULL; - if ((it->re = pcre2_compile((PCRE2_SPTR)regexp, PCRE2_ZERO_TERMINATED, PCRE2_NO_AUTO_CAPTURE, &errnumber, &pcre_error_offset, cctx)) == NULL) { + if ((it->re = pcre2_compile((PCRE2_SPTR)regexp, p - regexp, PCRE2_NO_AUTO_CAPTURE, &errnumber, &pcre_error_offset, cctx)) == NULL) { free(it); pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error)); blacklist_report_regexp_error((char *)pcre_error, pcre_error_offset); -- 2.40.0