[LTP] [PATCH v1] execl(), execlp() and execle() require proper termination of argument list

David Hildenbrand david@redhat.com
Mon Nov 28 10:45:44 CET 2022


On 25.11.22 15:06, Petr Vorel wrote:
> Hi David,
> 
> thanks for fixing this!
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>

This seems to be quite a controversial topic :)

I stumbled over [1], which still left me confused regarding what to do 
and what to not do.

Interestingly, the problem doesn't seem to be that NULL is defined in a 
strange way, but that the representation of (void *)NULL and (char 
*)NULL might be (weirdly enough) different, and that no explicit cast 
could result in undefined behavior.


IIUC, the second answer indicates that with C99 it might be fine, 
because that case is defined behavior ("one type is pointer to void and 
the other is a pointer to a character type.").


Having that said, I have cannot really tell if this change must be 
performed. :)


[1] 
https://stackoverflow.com/questions/52195275/can-the-compiler-cast-void-0-in-execlprog-arg-void-0-to-a-null-po

-- 
Thanks,

David / dhildenb



More information about the ltp mailing list