Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Fix the size of the output vector in our usage of pcre
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoisin committed Oct 13, 2017
1 parent af7d8bb commit dc64bf4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/sp_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ zend_always_inline int is_regexp_matching(const pcre* regexp, const char* str) {
return false;
}

ret = sp_pcre_exec(regexp, NULL, str, strlen(str), 0, 0, vec, sizeof(vec));
ret = sp_pcre_exec(regexp, NULL, str, strlen(str), 0, 0, vec,
sizeof(vec)/sizeof(int));

if (ret < 0) {
if (ret != PCRE_ERROR_NOMATCH) {
Expand Down Expand Up @@ -427,7 +428,8 @@ int hook_regexp(const pcre* regexp, HashTable* hook_table,
ZEND_HASH_FOREACH_STR_KEY(ht, key) {
if (key) {
int vec[30];
int ret = sp_pcre_exec(regexp, NULL, key->val, key->len, 0, 0, vec, 30);
int ret = sp_pcre_exec(regexp, NULL, key->val, key->len, 0, 0, vec,
sizeof(vec)/sizeof(int));
if (ret < 0) { /* Error or no match*/
if (PCRE_ERROR_NOMATCH != ret) {
sp_log_err("pcre", "Runtime error with pcre, error code: %d", ret);
Expand Down

0 comments on commit dc64bf4

Please sign in to comment.