mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 05:34:20 +01:00
Use defines to check alpn ext list validity
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
2064355747
commit
a32236c813
@ -125,6 +125,9 @@
|
|||||||
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */
|
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */
|
||||||
|
|
||||||
#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */
|
#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */
|
||||||
|
#define MBEDTLS_SSL_MAX_ALPN_NAME_LEN 255 /*!< Maximum size in bytes of a protocol name in alpn ext., RFC 7301 */
|
||||||
|
|
||||||
|
#define MBEDTLS_SSL_MAX_ALPN_LIST_LEN 65535 /*!< Maximum size in bytes of list in alpn ext., RFC 7301 */
|
||||||
|
|
||||||
/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
|
/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
|
||||||
* NONE must be zero so that memset()ing structure to zero works */
|
* NONE must be zero so that memset()ing structure to zero works */
|
||||||
|
@ -6526,7 +6526,9 @@ int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **prot
|
|||||||
cur_len = strlen( *p );
|
cur_len = strlen( *p );
|
||||||
tot_len += cur_len;
|
tot_len += cur_len;
|
||||||
|
|
||||||
if( cur_len == 0 || cur_len > 255 || tot_len > 65535 )
|
if( ( cur_len == 0 ) ||
|
||||||
|
( cur_len > MBEDTLS_SSL_MAX_ALPN_NAME_LEN ) ||
|
||||||
|
( tot_len > MBEDTLS_SSL_MAX_ALPN_LIST_LEN ) )
|
||||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user