From: "Todd C. Miller" Subject: Re: plug memory leak in got_pack_dump_delt_chain_to_file() To: Omar Polo Cc: gameoftrees@openbsd.org Date: Tue, 13 Feb 2024 13:00:58 -0700 On Tue, 13 Feb 2024 20:57:52 +0100, Omar Polo wrote: > On 2024/02/13 12:51:44 -0700, Todd C. Miller wrote: > > Won't this cause the uninitialized contents of accum_buf to be > > written out? I think this can happen for other error paths as well. > > ah yeah, I forgot to ask about this. accum_size is still zero so we > don't end up reading the uninitialized memory. However, we may clobber > err on fwrite, and we could handle it slightly better. > > what about this? I like it. Never writing accum_buf on err seems like the safest approach. - todd