Only memcpy() into imsg->data if datalen is not 0. Passing a NULL pointer
authorclaudio <claudio@openbsd.org>
Fri, 28 Jan 2022 10:41:44 +0000 (10:41 +0000)
committerclaudio <claudio@openbsd.org>
Fri, 28 Jan 2022 10:41:44 +0000 (10:41 +0000)
commite363f310b8962ee4bb09788e47fa94a8a0b1366d
treefafe864e285ca98918ed1f17da62dd4bd3f9b770
parentee3cba036407a07199589ce85e19af3c2e709493
Only memcpy() into imsg->data if datalen is not 0. Passing a NULL pointer
to memcpy() is UB no matter if len is 0.
Reported by fouzhe on openbgpd-portable github page.
OK tb@
lib/libutil/imsg.c