memcpy (and friends) with NULL pointers
Imperial Violet
JUNE 25, 2016
The C standard (ISO/IEC 9899:2011) has a sane-seeming definition of memcpy (section 7.24.2.1): The memcpy function copies n characters from the object pointed to by s2 into the object pointed to by s1. Apart from a prohibition on passing overlapping objects, I think every C programmer understands that. However, the standard also says (section 7.1.4): If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of th
Let's personalize your content