include: cbprintf: Fix call to memcpy with null pointer
cbprintf_package_convert may invoke z_cbprintf_cpy with a null pointer
to buf and zero length to indicate a flush operation. This triggers
an error from the undefined behavior sanitizer due to memcpy being called
with a null src, which is undefined behavior according to the C standard.
This is avoided by exiting early in z_cbprintf_cpy when length is zero.
Signed-off-by:
Tim Pambor <tim.pambor@codewrights.de>
Loading
Please sign in to comment