Skip to content

Commit 87bc915

Browse files
committed
Missed error check
1 parent faecff6 commit 87bc915

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/standard/browscap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ static int browser_reg_compare(
630630
}
631631

632632
match_data = pcre2_match_data_create_from_pattern(re, php_pcre_gctx());
633+
if (!match_data) {
634+
ZSTR_ALLOCA_FREE(pattern_lc, use_heap);
635+
zend_string_release(regex);
636+
return 0;
637+
}
633638
rc = pcre2_match(re, ZSTR_VAL(agent_name), ZSTR_LEN(agent_name), 0, re_options, match_data, php_pcre_mctx());
634639
pcre2_match_data_free(match_data);
635640
if (PCRE2_ERROR_NOMATCH != rc) {

0 commit comments

Comments
 (0)