mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-23 13:21:06 +00:00
Fixed potential heap buffer overflow on large hostname setting
This commit is contained in:
parent
694d3aeb47
commit
75c1a6f97c
|
@ -3220,6 +3220,10 @@ int ssl_set_hostname( ssl_context *ssl, const char *hostname )
|
||||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ssl->hostname_len = strlen( hostname );
|
ssl->hostname_len = strlen( hostname );
|
||||||
|
|
||||||
|
if( ssl->hostname_len + 1 == 0 )
|
||||||
|
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ssl->hostname = (unsigned char *) polarssl_malloc( ssl->hostname_len + 1 );
|
ssl->hostname = (unsigned char *) polarssl_malloc( ssl->hostname_len + 1 );
|
||||||
|
|
||||||
if( ssl->hostname == NULL )
|
if( ssl->hostname == NULL )
|
||||||
|
|
Loading…
Reference in a new issue