Commit 5a8b373cd01671285df647379299fbc5f49707c1

Stefan Sperling 2020-12-18T15:55:18

fix parsing of tag objects which lack a tag message This problem could be triggered with the u-boot repository: $ 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 $

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/object_parse.c b/lib/object_parse.c
index 87a2ed4..241ea3c 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -925,7 +925,7 @@ got_object_parse_tag(struct got_tag_object **tag, uint8_t *buf, size_t len)
 		}
 		s += slen + 1;
 		remain -= slen + 1;
-		if (remain <= 0) {
+		if (remain < 0) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}