[PATCH] nss_db: Fix initialization of iteration position [BZ #20237]

Florian Weimer fweimer@redhat.com
Fri Jun 10 15:55:00 GMT 2016


On 06/10/2016 05:44 PM, Carlos O'Donell wrote:
> On 06/10/2016 04:54 AM, Florian Weimer wrote:
>> When get*ent is called without a preceding set*ent, we need
>> to set the initial iteration position in get*ent.
>>
>> Reproducer: Add “services: db files” to /etc/nsswitch.conf, then run
>> “perl -e getservent”.  It will segfault before this change, and exit
>> silently after it.
>>
>> 2016-06-10  Florian Weimer  <fweimer@redhat.com>
>>
>> 	[BZ #20237]
>> 	* nss/nss_db/db-XXX.c (set*ent): Reset entidx to NULL.
>> 	(get*ent): Set entidx to NULL during initialization.  If entidx is
>> 	NULL, start iteration from the beginning.
>
> The fix looks good, but surely this needs a regression test?

The problems are quite similar to nss_files testing:

   https://sourceware.org/ml/libc-alpha/2016-04/msg00392.html

Build-time testing is only possible with chroot and (user) namespaces.

Thanks,
Florian



More information about the Libc-alpha mailing list