This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allocation buffers for NSS result construction


On 06/16/2017 09:06 PM, DJ Delorie wrote:
> Florian Weimer <fweimer@redhat.com> writes:
>> I don't quite understand what you are after.  I think if the code has to
>> deal with bad data, explicit checks are better than relying on fringe
>> behavior of library functions (printf and "(null)" is another example).
>>
>> Please post example code, so that I can better understand your requirement.
> https://www.sourceware.org/ml/libc-alpha/2017-05/msg00074.html
> 
> The data I'm passing from the nss_test helpers may have NULL where a
> "char *" string is expected.  If the NSS core calls strlen() on it, it
> will crash.  When I'm building the buffer, I can't just call strlen() or
> it will crash.  I'm testing to make sure it doesn't crash, and that the
> NULL is passed along to the caller

Do you mean the COPY_IF_ROOM macro?

I think you'll have to keep a NULL check in it because this use case is
quite obscure.  I think most other NSS module implementations only copy
data into the output if they actually have any data, so the pointer is
already guaranteed to be not NULL when the data is copied.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]