Skip to content

Commit 94fce58

Browse files
authored
Merge pull request libgit2#4894 from pks-t/pks/commit-author-oob
commit: fix out-of-bound reads when parsing truncated author fields
2 parents 11d33df + cb23c3e commit 94fce58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
420420
return -1;
421421

422422
/* Some tools create multiple author fields, ignore the extra ones */
423-
while ((size_t)(buffer_end - buffer) >= strlen("author ") && !git__prefixcmp(buffer, "author ")) {
423+
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) {
424424
if (git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n') < 0)
425425
return -1;
426426

0 commit comments

Comments
 (0)