Commit be89e2b1c0f85ecb74db9d64b319e9919cbaa098

Stefan Sperling 2018-03-03T14:02:13

In read_to_mem() loop, don't overwrite already read blocks

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/object.c b/lib/object.c
index 9b7df25..840d8ed 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -584,7 +584,7 @@ read_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
 			buf = newbuf;
 			remain += blocksize;
 		}
-		n = fread(buf, 1, remain, f);
+		n = fread(buf + total, 1, remain, f);
 		if (n == 0) {
 			if (ferror(f)) {
 				err = got_ferror(f, GOT_ERR_IO);