com php-src: Avoid strlen call: ext/opcache/zend_accelerator _blacklist.c
| From: | Anatol Belski | Date: | Tue, 19 Dec 2017 11:57:39 +0000 |
| Subject: | com php-src: Avoid strlen call: ext/opcache/zend_accelerator _blacklist.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100638@lists.php.net to get a copy of this message | ||
Commit: 80571d6f967c879a5f1c457fbc51092df5d131a4
Author: Anatol Belski <ab@php.net> Tue, 19 Dec 2017 12:14:50 +0100
Parents: e512305581bb1bb3e4226e3073b89f2a25214403
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=80571d6f967c879a5f1c457fbc51092df5d131a4
Log:
Avoid strlen call
Changed paths:
M ext/opcache/zend_accelerator_blacklist.c
Diff:
diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c
index 78df0e4..46d50cf 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);