RFC8446 requires that a PSK identity is at least one byte in length. We
should validate this.
Fixes #31007
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sun May 3 13:46:21 2026
(Merged from https://github.com/openssl/openssl/pull/31058)
}
idlen = PACKET_remaining(&identity);
+ if (idlen == 0) {
+ SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_BAD_EXTENSION);
+ return 0;
+ }
if (s->psk_find_session_cb != NULL
&& !s->psk_find_session_cb(ussl, PACKET_data(&identity), idlen,
&sess)) {