commit 92088384cf9225cf40ca024b6ec669222b785347 from: Stefan Sperling date: Sun Apr 01 21:00:57 2018 UTC fix use of unitialized value in case of EOF in got_inflate_read() commit - e1e3f5707400e6ae29df113968ebcdff42393d63 commit + 92088384cf9225cf40ca024b6ec669222b785347 blob - 93279f0bf680a472e0cb41a40a8d532c98c55778 blob + 2b3120f98279f1802f0187c4a387f17ba660f9fe --- lib/zbuf.c +++ lib/zbuf.c @@ -71,7 +71,7 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, { size_t last_total_out = zb->z.total_out; z_stream *z = &zb->z; - int ret; + int ret = Z_ERRNO; z->next_out = zb->outbuf; z->avail_out = zb->outlen; @@ -83,7 +83,9 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, if (n == 0) { if (ferror(f)) return got_ferror(f, GOT_ERR_IO); - break; /* EOF */ + /* EOF */ + ret = Z_STREAM_END; + break; } z->next_in = zb->inbuf; z->avail_in = n;