Skip to content

Commit

Permalink
Fix crash with DTLS_CONNECTION_ID but not other SSL features
Browse files Browse the repository at this point in the history
In configurations with MBEDTLS_SSL_DTLS_CONNECTION_ID enabled but none of
MBEDTLS_SSL_HW_RECORD_ACCEL, MBEDTLS_SSL_EXPORT_KEYS or MBEDTLS_DEBUG_C,
DTLS handshakes using CID would crash due to a null pointer dereference.
Fix this. Fixes Mbed-TLS#3998.

Detected by running compat.sh in config-ccm-psk-dtls1_2.h.

Signed-off-by: Gilles Peskine <[email protected]>
  • Loading branch information
gilles-peskine-arm committed Apr 13, 2022
1 parent bcb2ab0 commit a6f99a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.d/dtls-cid-null.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix
* In configurations with MBEDTLS_SSL_DTLS_CONNECTION_ID enabled but none of
MBEDTLS_SSL_HW_RECORD_ACCEL, MBEDTLS_SSL_EXPORT_KEYS or MBEDTLS_DEBUG_C,
DTLS handshakes using CID would crash due to a null pointer dereference.
Fix this. Fixes #3998.
1 change: 1 addition & 0 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ static int ssl_populate_transform( mbedtls_ssl_transform *transform,

#if !defined(MBEDTLS_SSL_HW_RECORD_ACCEL) && \
!defined(MBEDTLS_SSL_EXPORT_KEYS) && \
!defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
!defined(MBEDTLS_DEBUG_C)
ssl = NULL; /* make sure we don't use it except for those cases */
(void) ssl;
Expand Down

0 comments on commit a6f99a1

Please sign in to comment.