Skip to content

Commit

Permalink
Merge pull request #148 from visitorckw/fix-strncmp
Browse files Browse the repository at this point in the history
Fix potential out-of-bounds access in strncmp()
  • Loading branch information
jserv authored Aug 10, 2024
2 parents c56c590 + 529d827 commit 4b8c4e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ int strncmp(char *s1, char *s2, int len)
return -1;
if (s1[i] > s2[i])
return 1;
if (!s1[i])
return 0;
i++;
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/fib.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/snapshots/hello.json

Large diffs are not rendered by default.

0 comments on commit 4b8c4e6

Please sign in to comment.