]> granicus.if.org Git - php/commitdiff
Avoid strlen call
authorAnatol Belski <ab@php.net>
Tue, 19 Dec 2017 11:14:50 +0000 (12:14 +0100)
committerAnatol Belski <ab@php.net>
Tue, 19 Dec 2017 11:57:39 +0000 (12:57 +0100)
ext/opcache/zend_accelerator_blacklist.c

index 78df0e476dc3ab3737fb4c1c975597740ee3482a..46d50cf96dd1447037faafa69f2a4436334a51bb 100644 (file)
@@ -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);