Resend: [PATCH] Avoid use of uninitialized values in guid.c
Chris Shoemaker
c.shoemaker at cox.net
Tue Feb 15 18:32:40 EST 2005
On Tue, Feb 15, 2005 at 05:59:08PM -0500, Derek Atkins wrote:
>
> The easiest way to fix that is the memset(&sb, 0, sizeof(sb)) before
> the stat() call.
>
> >> The only thing I intended was to avoid the uninitialized read.
>
> Fair enough. I think a memset ahead of the stat would solve the
> initialization problem.
You're right.
>
> >> > > - guid_memchunk_init();
> >> > > + /* Not needed: taken care of on first malloc.
> >> > > + /* guid_memchunk_init(); */
> >> >
> >> > The problem is that you don't know which one is called first,
> >> > guid_init() or guid_malloc(). If you want to protect the
> >> > memchunk_init() from being double-called, that's fine.
> >> >
> >>
> >> AFAICS, it's not a problem. We don't use the memchunk until after the
> >> guid_malloc, so why init it earlier?
>
> I'd have to look closer; where does the prng get seeded? I know there
> are places where we initialize the guid code to seed the prng and then
> use the prng later.
I think that's unrelated. AFAICT, guid_memchunk_init only touches
guid_memchunk. The only user of guid_memchunk is guid_malloc.
-chris
More information about the gnucash-patches
mailing list