Skip to content

Commit

Permalink
fix #156: Heap buffer overflow in match_at() with case-insensitive match
Browse files Browse the repository at this point in the history
  • Loading branch information
kkos committed Oct 4, 2019
1 parent bc4a2ba commit 15c4228
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/regcomp.c
Expand Up @@ -734,8 +734,8 @@ add_compile_string(UChar* s, int mb_len, int str_len,
COP(reg)->exact_n.s = p;
}
else {
xmemset(COP(reg)->exact.s, 0, sizeof(COP(reg)->exact.s));
xmemcpy(COP(reg)->exact.s, s, (size_t )byte_len);
COP(reg)->exact.s[byte_len] = '\0';
}

return 0;
Expand Down
1 change: 1 addition & 0 deletions src/regexec.c
Expand Up @@ -2889,6 +2889,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(0);
q = lowbuf;
while (len-- > 0) {
if (ps >= endp) goto fail;
if (*ps != *q) goto fail;
ps++; q++;
}
Expand Down

0 comments on commit 15c4228

Please sign in to comment.