]> git.ipfire.org Git - thirdparty/bind9.git/commit
isc_buffer_*(): if source can be NULL, only call memmove() when length is non-zero
authorMichał Kępień <michal@isc.org>
Tue, 15 May 2018 06:18:01 +0000 (08:18 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 15 May 2018 07:11:34 +0000 (09:11 +0200)
commit6ddbca6f2bc94b7e45958dab5576b3d9e48a6e5e
treeeec7eb5f72a4cbe0652a319c272bfdc163ebc72e
parent9bc6ba0be9447c66d8f2b055a696ff12842c7863
isc_buffer_*(): if source can be NULL, only call memmove() when length is non-zero

Certain isc_buffer_*() functions might call memmove() with the second
argument (source) set to NULL and the third argument (length) set to 0.
While harmless, it triggers an ubsan warning:

    runtime error: null pointer passed as argument 2, which is declared to never be null

Modify all memmove() call sites in lib/isc/include/isc/buffer.h and
lib/isc/buffer.c which may potentially use NULL as the second argument
(source) so that memmove() is only called if the third argument (length)
is non-zero.
lib/isc/buffer.c
lib/isc/include/isc/buffer.h
lib/isc/netaddr.c