mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 04:05:30 +00:00
Added max length checking of hostname
This commit is contained in:
parent
f592e8eaf6
commit
89f77623b8
|
@ -139,6 +139,9 @@
|
||||||
#define MBEDTLS_SSL_TRANSPORT_STREAM 0 /*!< TLS */
|
#define MBEDTLS_SSL_TRANSPORT_STREAM 0 /*!< TLS */
|
||||||
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */
|
#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */
|
||||||
|
|
||||||
|
#define MBEDTLS_SSL_MAX_HOST_NAME 255 /*!< Maximum host name
|
||||||
|
defined in RFC 1035 */
|
||||||
|
|
||||||
/* 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 */
|
||||||
#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */
|
#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */
|
||||||
|
|
|
@ -5833,6 +5833,9 @@ int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname )
|
||||||
if( hostname_len + 1 == 0 )
|
if( hostname_len + 1 == 0 )
|
||||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
|
if( hostname_len > MBEDTLS_SSL_MAX_HOST_NAME )
|
||||||
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ssl->hostname = mbedtls_calloc( 1, hostname_len + 1 );
|
ssl->hostname = mbedtls_calloc( 1, hostname_len + 1 );
|
||||||
|
|
||||||
if( ssl->hostname == NULL )
|
if( ssl->hostname == NULL )
|
||||||
|
|
Loading…
Reference in a new issue