diff options
author | Gilles Peskine <gilles.peskine@arm.com> | 2020-11-18 18:40:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 18:40:50 +0100 |
commit | 9f0da915b599020f263e3bb26e2cd24a226111ff (patch) | |
tree | b6dde50e2abc65af8a65e2ed76581562f635fff4 | |
parent | 481ff8e621e0f737320d3039f90eb53c60565907 (diff) | |
parent | e78a0c3e14375f61aec145d4adba81508fc5d0a8 (diff) | |
download | mbedtls-9f0da915b599020f263e3bb26e2cd24a226111ff.zip mbedtls-9f0da915b599020f263e3bb26e2cd24a226111ff.tar.gz mbedtls-9f0da915b599020f263e3bb26e2cd24a226111ff.tar.bz2 |
Merge pull request #3893 from maroneze/mbedtls-2.16
Backport 2.16: Fix another use of uinitialized memory in ssl_parse_encrypted_pms
-rw-r--r-- | library/ssl_srv.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 97b7784..cbf6142 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -3587,11 +3587,12 @@ static int ssl_parse_encrypted_pms( mbedtls_ssl_context *ssl, /* In case of a failure in decryption, the decryption may write less than * 2 bytes of output, but we always read the first two bytes. It doesn't * matter in the end because diff will be nonzero in that case due to - * peer_pmslen being less than 48, and we only care whether diff is 0. - * But do initialize peer_pms for robustness anyway. This also makes - * memory analyzers happy (don't access uninitialized memory, even - * if it's an unsigned char). */ + * ret being nonzero, and we only care whether diff is 0. + * But do initialize peer_pms and peer_pmslen for robustness anyway. This + * also makes memory analyzers happy (don't access uninitialized memory, + * even if it's an unsigned char). */ peer_pms[0] = peer_pms[1] = ~0; + peer_pmslen = 0; ret = ssl_decrypt_encrypted_pms( ssl, p, end, peer_pms, |