mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-12 08:38:08 -04:00
Added max length checking of hostname
This commit is contained in:
parent
2cf9696785
commit
13ca8951f9
@ -121,6 +121,8 @@
|
||||
#define SSL_LEGACY_ALLOW_RENEGOTIATION 1
|
||||
#define SSL_LEGACY_BREAK_HANDSHAKE 2
|
||||
|
||||
#define SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */
|
||||
|
||||
/*
|
||||
* Size of the input / output buffer.
|
||||
* Note: the RFC defines the default size of SSL / TLS messages. If you
|
||||
|
@ -3350,6 +3350,9 @@ int ssl_set_hostname( ssl_context *ssl, const char *hostname )
|
||||
if( ssl->hostname_len + 1 == 0 )
|
||||
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 = (unsigned char *) malloc( ssl->hostname_len + 1 );
|
||||
|
||||
if( ssl->hostname == NULL )
|
||||
|
Loading…
x
Reference in New Issue
Block a user