[PATCH][BZ #16453] Don't use alloca in addgetnetgrentX
Carlos O'Donell
carlos@redhat.com
Wed Jan 15 15:45:00 GMT 2014
On 01/15/2014 10:32 AM, Siddhesh Poyarekar wrote:
> On 15 January 2014 20:57, Mike Frysinger <vapier@gentoo.org> wrote:
>> On Wednesday 15 January 2014 06:34:52 Siddhesh Poyarekar wrote:
>>> The bug report has a reproducer and I verified that the reproducer is
>>> fixed with this patch. OK to commit?
>>
>> is there no way for us to set up local paths for networking files specifically
>> for testing purposes ? seems like a pretty big hole in our testing abilities.
>>
>
> The paths are hardcoded, which is why this is difficult and because of
> that, nscd testing is essentially a noop. The chroot-based testing
> framework that Ryan is working on will help this quite a bit.
>
>>> + buflen = MAX (2 * buflen,
>>> + buflen + 2 * needed);
>>> + char *newbuf = xrealloc (buffer, buflen);
>>> + buffer = newbuf;
>>
>> why newbuf ? this should work fine:
>> buffer = xrealloc (buffer, buflen);
>>
>>> - extend_alloca (buffer, buflen, newsize);
>>> + buflen *= 2;
>>> + char *newbuf = xrealloc (buffer, buflen);
>>> + buffer = newbuf;
>>
>> same here
>
> Thanks, I'll fix these when I commit, provided there are no other
> issues with the patch.
It looks good to me too. Removing alloca as much as possible is
a security win, and I agree with your analysis that this isn't
a performance issue (until someone shows it is).
Testing nscd is something we need to work on, and cross-testing
makes that more difficult.
Cheers,
Carlos.
More information about the Libc-alpha
mailing list