Commit Diff
- Commit:
08603e79bbb2bb6324cad8aa08311f2f47f8822d
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
- Message:
- zero-initialize all of struct got_inflate_buf in got_inflate_init() Fixes a potential bogus free on error. got_inflate_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_inflate_end() in an error path.
- Actions:
- Patch | Tree
--- lib/inflate.c +++ lib/inflate.c @@ -44,7 +44,7 @@ got_inflate_init(struct got_inflate_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;