Commit Diff
- Commit:
0fc5e2291f12e5d2a36b4c850747157fcc365682
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
- Message:
- zero-initialize all of struct got_deflate_buf in got_deflate_init() Fixes a potential bogus free on error. got_deflate_end() relies on zb.flags to be initialized. It will try to free a bogus zb.outbuf pointer if zb.flags happens to set by uninitialized stack memory while we are calling got_deflate_end() in an error path.
- Actions:
- Patch | Tree
--- lib/deflate.c +++ lib/deflate.c @@ -41,7 +41,7 @@ got_deflate_init(struct got_deflate_buf *zb, uint8_t * const struct got_error *err = NULL; int zerr; - memset(&zb->z, 0, sizeof(zb->z)); + memset(zb, 0, sizeof(*zb)); zb->z.zalloc = Z_NULL; zb->z.zfree = Z_NULL;