Skip to content

Commit

Permalink
fix for possible out-of-bounds memory access in repl
Browse files Browse the repository at this point in the history
  • Loading branch information
codeplea committed May 23, 2021
1 parent 61af1dd commit 6b9b727
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ static char *readline(const char *prompt) {
}

size_t len = strlen(line);

if (len < 1)
return NULL;

if (line[len - 1] == '\n') {
line[len - 1] = '\0';
len -= 1;
Expand Down

0 comments on commit 6b9b727

Please sign in to comment.