Fix stack-buffer-overflow in parse_regex due to missing bounds checks (#1486)

Fixes: https://issues.oss-fuzz.com/issues/388922799
pull/1495/head
Shivam7-1 4 weeks ago committed by GitHub
parent 00886ee90d
commit 41aa292e97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      libclamav/regex_suffix.c

@ -274,7 +274,7 @@ static struct node *parse_regex(const uint8_t *p, const size_t pSize, size_t *la
struct node *right;
struct node *tmp;
while (p[*last] != '$' && p[*last] != '\0') {
while (*last < pSize && p[*last] != '$' && p[*last] != '\0') {
switch (p[*last]) {
case '|':
++*last;
@ -356,6 +356,7 @@ static struct node *parse_regex(const uint8_t *p, const size_t pSize, size_t *la
++*last;
/* fall-through */
default:
if (*last >= pSize) break;
right = make_leaf(p[*last]);
v = make_node(concat, v, right);
if (!v) {

Loading…
Cancel
Save