-
Simon McVittie authored
Some callers of these functions ask to copy 0 items from a NULL source, which would be valid if they were copied in a loop (because NULL would never be dereferenced), but is declared to be undefined behaviour for Standard C memcpy. Guard the call to memcpy so that we only call it if we have more than 0 items, and therefore should have a non-NULL source pointer. Detected by running a subset of the test suite with -Dsanitize=address,undefined on x86_64. Signed-off-by: Simon McVittie <smcv@debian.org>
6649af5e
Loading