mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-24 22:25:11 +00:00
Added max length checking of hostname
This commit is contained in:
parent
21823f9a69
commit
c988f32add
|
@ -198,6 +198,8 @@
|
||||||
#endif /* POLARSSL_SSL_PROTO_TLS1_1 */
|
#endif /* POLARSSL_SSL_PROTO_TLS1_1 */
|
||||||
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
|
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
|
||||||
|
|
||||||
|
#define SSL_MAX_HOST_NAME_LEN 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 SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */
|
#define SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */
|
||||||
|
|
|
@ -4148,6 +4148,9 @@ int ssl_set_hostname( ssl_context *ssl, const char *hostname )
|
||||||
if( ssl->hostname_len + 1 == 0 )
|
if( ssl->hostname_len + 1 == 0 )
|
||||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
|
if( ssl->hostname_len > SSL_MAX_HOST_NAME_LEN )
|
||||||
|
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ssl->hostname = polarssl_malloc( ssl->hostname_len + 1 );
|
ssl->hostname = polarssl_malloc( ssl->hostname_len + 1 );
|
||||||
|
|
||||||
if( ssl->hostname == NULL )
|
if( ssl->hostname == NULL )
|
||||||
|
|
Loading…
Reference in a new issue