Skip to content

Commit

Permalink
regexec.c: avoid overflow in computing sum of lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
eggert authored and Ulrich Drepper committed Jan 22, 2010
1 parent eadc09f commit 42a2c9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2010-01-22 Jim Meyering <[email protected]>

[BZ #11191]
* posix/regexec.c (re_search_2_stub): Check for overflow
when adding the sizes of the two strings.

[BZ #11190]
* posix/regexec.c (re_search_internal): Avoid overflow
in computing re_malloc buffer size.
Expand Down
2 changes: 1 addition & 1 deletion posix/regexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
int len = length1 + length2;
char *s = NULL;

if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
return -2;

/* Concatenate the strings. */
Expand Down

0 comments on commit 42a2c9b

Please sign in to comment.