Skip to content

Commit ea4f968

Browse files
committed
unpack_object_header_buffer(): clear the size field upon error
The callers do not use the returned size when the function says it did not use any bytes and sets the type to OBJ_BAD, so this should not matter in practice, but it is a good code hygiene anyway. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c6bebd commit ea4f968

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sha1_file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,8 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf,
12671267
while (c & 0x80) {
12681268
if (len <= used || bitsizeof(long) <= shift) {
12691269
error("bad object header");
1270-
return 0;
1270+
size = used = 0;
1271+
break;
12711272
}
12721273
c = buf[used++];
12731274
size += (c & 0x7f) << shift;

0 commit comments

Comments
 (0)