mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix possible UB in mbedtls_asn1_write_raw_buffer()
This is mostly unrelated to other commits in this PR, except for the fact that one of the added X.509 tests revealed that with UBSan. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@ -90,7 +90,9 @@ int mbedtls_asn1_write_raw_buffer(unsigned char **p, const unsigned char *start,
|
||||
|
||||
len = size;
|
||||
(*p) -= len;
|
||||
memcpy(*p, buf, len);
|
||||
if (len != 0) {
|
||||
memcpy(*p, buf, len);
|
||||
}
|
||||
|
||||
return (int) len;
|
||||
}
|
||||
|
Reference in New Issue
Block a user