On Mon, Jan 12, 2015 at 08:18, Damien Miller wrote: > CVSROOT: /cvs > Module name: src > Changes by: d...@cvs.openbsd.org 2015/01/12 08:18:07 > > Modified files: > usr.bin/ssh : sshbuf-getput-basic.c sshbuf-getput-crypto.c > > Log message: > apparently memcpy(x, NULL, 0) is undefined behaviour according to > C99 (cf. sections 7.21.1 and 7.1.4), so check skip memcpy calls when > length==0; ok markus@
Some of this change looks unnecessary. The standard does require that all pointers be non-NULL, but it explicitly says that a length of zero is acceptable. From the looks of things, there were already NULL pointer checks before the memcpy calls; that should have been fine.