Fix bug with extension-less ServerHello
https://tls.mbed.org/discussions/bug-report-issues/server-hello-parsing-bug
in_hslen include the length of the handshake header. (We might want to change
that in the future, as it is a bit annoying.)
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 1d683d3..b09a7ab 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -1269,7 +1269,7 @@
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
- if( ssl->in_hslen > 39 + n )
+ if( ssl->in_hslen > mbedtls_ssl_hs_hdr_len( ssl ) + 39 + n )
{
ext_len = ( ( buf[38 + n] << 8 )
| ( buf[39 + n] ) );
@@ -1281,7 +1281,7 @@
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}
}
- else if( ssl->in_hslen == 38 + n )
+ else if( ssl->in_hslen == mbedtls_ssl_hs_hdr_len( ssl ) + 38 + n )
{
ext_len = 0;
}