If someone truly believes you should break software that made bad assumptions about memcpy, as a matter of engineering principle, then just stick this at the top of memcpy and be done with it:
if((src <= dest && src+len >= dest) || (dest <= src && dest+len >= src)) abort(); /* valid - spec says behaviour is undefined */
;)
If someone truly believes you should break software that made bad assumptions about memcpy, as a matter of engineering principle, then just stick this at the top of memcpy and be done with it: