Commit cc62643986abd93b4a2dae15c40415c625646fc2

Stefan Sperling 2019-07-15T13:16:26

make got-read-blob account for header len in size check Fixes "no space" error with blobs which happen to straddle the size boundary for in-memory handling.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libexec/got-read-blob/got-read-blob.c b/libexec/got-read-blob/got-read-blob.c
index 0e375fd..9c71c91 100644
--- a/libexec/got-read-blob/got-read-blob.c
+++ b/libexec/got-read-blob/got-read-blob.c
@@ -144,7 +144,8 @@ main(int argc, char *argv[])
 			goto done;
 		}
 
-		if (obj->size <= GOT_PRIVSEP_INLINE_BLOB_DATA_MAX) {
+		if (obj->size + obj->hdrlen <=
+		    GOT_PRIVSEP_INLINE_BLOB_DATA_MAX) {
 			err = got_inflate_to_mem(&buf, &size, f);
 			if (err)
 				goto done;