commit 54382dcc5e1ccefbc74e7615bc5c0a0aef7ccf3a from: Stefan Sperling date: Sun Feb 11 15:12:55 2018 UTC keep reading zlib stream until end maker when expanding to mem commit - c743ac7dd29b36dd1baf4857bcfa512b34b28da7 commit + 54382dcc5e1ccefbc74e7615bc5c0a0aef7ccf3a blob - 361d6bdfa043380b0f148cf09997b15ec71b1eec blob + afccbd6a660789099bba0350408e7af92ebbe9cc --- lib/zb.c +++ lib/zb.c @@ -126,13 +126,13 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, F *outlen = 0; inbytes = 0; - do { + while (1) { err = got_inflate_read(&zb, f, &consumed, &avail); if (err) return err; inbytes += consumed; if (avail == 0) { - if (inbytes < insize) + if (insize && inbytes < insize) err = got_error(GOT_ERR_BAD_DELTA); break; } @@ -147,7 +147,7 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, F memcpy(newbuf + *outlen, zb.outbuf, avail); *outbuf = newbuf; *outlen += avail; - } while (inbytes < insize); + }; done: got_inflate_end(&zb);