mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fixed undefined behavior in ssl_read if buf parameter is NULL.
Signed-off-by: Ashley Duncan <ashes.man@gmail.com>
This commit is contained in:
committed by
Dave Rodgman
parent
a3b625b0a1
commit
358f94a71c
@ -5593,8 +5593,10 @@ int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len)
|
|||||||
n = (len < ssl->in_msglen)
|
n = (len < ssl->in_msglen)
|
||||||
? len : ssl->in_msglen;
|
? len : ssl->in_msglen;
|
||||||
|
|
||||||
memcpy(buf, ssl->in_offt, n);
|
if (buf) {
|
||||||
ssl->in_msglen -= n;
|
memcpy(buf, ssl->in_offt, n);
|
||||||
|
ssl->in_msglen -= n;
|
||||||
|
}
|
||||||
|
|
||||||
/* Zeroising the plaintext buffer to erase unused application data
|
/* Zeroising the plaintext buffer to erase unused application data
|
||||||
from the memory. */
|
from the memory. */
|
||||||
|
Reference in New Issue
Block a user