mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-07-30 16:26:33 +08:00
Merge f0422f56d11ab3f4d9cde32fb38ab074bd5c88d7 into 3bb373867917b674265067cbd38b9d252c43d014
This commit is contained in:
commit
aa0046d13c
7
ChangeLog.d/fix-alpn-empty-list.txt
Normal file
7
ChangeLog.d/fix-alpn-empty-list.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Bugfix
|
||||
* Fix mbedtls_ssl_conf_alpn_protocols() silently accepting an empty
|
||||
protocol list, which caused an invalid ALPN extension with a
|
||||
zero-length protocol_name_list to be sent during the handshake,
|
||||
violating RFC 7301 and causing conforming peers to reject the
|
||||
connection with a fatal decode error. mbedtls_ssl_conf_alpn_protocols()
|
||||
now returns MBEDTLS_ERR_SSL_BAD_INPUT_DATA for an empty list.
|
||||
@ -2526,6 +2526,16 @@ int mbedtls_ssl_conf_alpn_protocols(mbedtls_ssl_config *conf,
|
||||
size_t cur_len, tot_len;
|
||||
const char *const *p;
|
||||
|
||||
/*
|
||||
* RFC 7301 3.1: the ALPN extension's protocol_name_list must contain
|
||||
* at least one entry - an empty list is not a valid ProtocolNameList
|
||||
* and must not be sent. Reject it here rather than silently sending
|
||||
* an ALPN extension with a zero-length list later.
|
||||
*/
|
||||
if (*protos == NULL) {
|
||||
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
/*
|
||||
* RFC 7301 3.1: "Empty strings MUST NOT be included and byte strings
|
||||
* MUST NOT be truncated."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user