mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-11-06 19:29:29 +03:00
mbedtls_mpi_read_binary() calls memcpy() with the source pointer being the source pointer passed to mbedtls_mpi_read_binary(), the latter may be NULL if the buffer length is 0 (and this happens e.g. in the ECJPAKE test suite). The behavior of memcpy(), in contrast, is undefined when called with NULL source buffer, even if the length of the copy operation is 0. This commit fixes this by explicitly checking that the source pointer is not NULL before calling memcpy(), and skipping the call otherwise.
66 KiB
66 KiB