From 2a87e9bf83640e3b1bc86679c52656c26a0212c2 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Wed, 19 Oct 2022 10:55:26 +0200 Subject: [PATCH] tls: Align set and usage check for PSK Check that the identity length is not zero in ssl_conf_set_psk_identity() as it is done in mbedtls_ssl_conf_has_static_psk(). Signed-off-by: Ronald Cron --- library/ssl_tls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 4678f53864..a3586e7470 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1654,6 +1654,7 @@ static int ssl_conf_set_psk_identity( mbedtls_ssl_config *conf, { /* Identity len will be encoded on two bytes */ if( psk_identity == NULL || + psk_identity_len == 0 || ( psk_identity_len >> 16 ) != 0 || psk_identity_len > MBEDTLS_SSL_OUT_CONTENT_LEN ) {