[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: memory corruption in new MEMORY keytab



On Fri, 2005-12-02 at 22:46 -0500, Michael B Allen wrote:
> On Sat, 03 Dec 2005 11:49:52 +1100
> Andrew Bartlett <abartlet@samba.org> wrote:
> 
> > [keytab_memory_fix.patch  text/x-patch (974 bytes)]
> > --- /data/heimdal/lib/krb5/keytab_memory.c	2005-12-02 07:58:29.000000000 +1100
> > +++ heimdal/lib/krb5/keytab_memory.c	2005-12-03 11:41:04.000000000 +1100
> > @@ -214,9 +214,15 @@
> >  	krb5_clear_error_string (context);
> >  	return KRB5_KT_NOTFOUND;
> >      }
> > -    e = realloc(d->entries, d->num_entries * sizeof(*d->entries));
> > -    if(e != NULL)
> > -	      d->entries = e;
> 
> I might be missing a lot of context here but all of this looks like a
> roundabout way of saying:
> 
>        d->entries = realloc(d->entries, d->num_entries * sizeof(*d->entries));

Presuming the realloc failed (not possible in this case, as it is a
realloc for a smaller size), it would return NULL, but you would still
want to free the original pointer.

In sort, yes.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Student Network Administrator, Hawker College  http://hawkerc.net

This is a digitally signed message part