As noted in undefined behavior 179 of Annex J of the C standard [ISO/IEC 9899:2011], the behavior a program is undefined when
...
Section 7.22.3 of the C standard [ISO/IEC 9899:2011] states:
If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object.
...
CERT C Secure Coding Standard: MEM04-C. Do not perform zero length allocations
ISISO/IEC 9899:2011 Section 7.22.3, "Memory management functions"
...