"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
fix parsing of tag objects with empty tag message
To:
gameoftrees@openbsd.org
Date:
Tue, 15 Dec 2020 21:18:23 +0100

Download raw body.

Thread
  • Stefan Sperling:

    fix parsing of tag objects with empty tag message

The u-boot repository cannot be read by Got because this repository
contains tags with an empty tag message which is currently treated
as a parsing error.

$ git clone --bare https://gitlab.denx.de/u-boot/u-boot.git
$ got log -r u-boot.git
got-read-pack: bad object data
got: bad object data
$

This fixes the issue. Ok?

diff 7e2d1ba3edd9247bf97df8e5b7d9abe7a762f370 /home/stsp/src/got
blob - 87a2ed47fc53ce199f828d6f49ba4cd304e3b52f
file + lib/object_parse.c
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -925,7 +925,7 @@ got_object_parse_tag(struct got_tag_object **tag, uint
 		}
 		s += slen + 1;
 		remain -= slen + 1;
-		if (remain <= 0) {
+		if (remain < 0) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}