Skip to content

Commit

Permalink
Fix crash in .i~s .. recursive infinite grep strings issue (#14718)
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jul 31, 2019
1 parent 2584764 commit c1f7b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libr/cons/grep.c
Expand Up @@ -316,13 +316,13 @@ static void parse_grep_expression(const char *str) {
eprintf ("grep string too long\n");
continue;
}
strncpy (grep->strings[grep->nstrings],
optr, R_CONS_GREP_WORD_SIZE - 1);
grep->nstrings++;
if (grep->nstrings > R_CONS_GREP_WORDS - 1) {
eprintf ("too many grep strings\n");
break;
}
strncpy (grep->strings[grep->nstrings - 1],
optr, R_CONS_GREP_WORD_SIZE - 1);
} while (ptr);
} else {
grep->str = strdup (ptr);
Expand Down

0 comments on commit c1f7b28

Please sign in to comment.