Skip to content

Commit 8a272f2

Browse files
rscharfepeff
authored andcommitted
fsck: treat a NUL in a tag header as an error
We check the return value of verify_header() for commits already, so do the same for tags as well. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 80c7f5a commit 8a272f2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fsck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
711711
}
712712
}
713713

714-
if (verify_headers(buffer, size, &tag->object, options))
714+
ret = verify_headers(buffer, size, &tag->object, options);
715+
if (ret)
715716
goto done;
716717

717718
if (!skip_prefix(buffer, "object ", &buffer)) {

t/t1450-fsck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ test_expect_success 'tag with bad tagger' '
288288
grep "error in tag .*: invalid author/committer" out
289289
'
290290

291-
test_expect_failure 'tag with NUL in header' '
291+
test_expect_success 'tag with NUL in header' '
292292
sha=$(git rev-parse HEAD) &&
293293
q_to_nul >tag-NUL-header <<-EOF &&
294294
object $sha

0 commit comments

Comments
 (0)