Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low-hanging fruit from the R repository #106

Merged
merged 15 commits into from
Aug 16, 2024
Prev Previous commit
Next Next commit
Fix potential buffer overflow in macro expansion.
Obtained from the R repository.
  • Loading branch information
dag-erling committed Jul 30, 2024
commit 577ec412f342143c2103f71fb513952db8e99383
2 changes: 1 addition & 1 deletion lib/tre-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ tre_expand_macro(const tre_char_t *regex, const tre_char_t *regex_end,
unsigned int j;
DPRINT(("Expanding macro '%c' => '%s'\n",
tre_macros[i].c, tre_macros[i].expansion));
for (j = 0; tre_macros[i].expansion[j] && j < buf_len; j++)
for (j = 0; tre_macros[i].expansion[j] && j < buf_len - 1; j++)
buf[j] = tre_macros[i].expansion[j];
buf[j] = 0;
break;
Expand Down