No memmove: ssl_parse_hello_verify_request()
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 5742616..cab6741 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -959,7 +959,7 @@
#if defined(POLARSSL_SSL_PROTO_DTLS)
static int ssl_parse_hello_verify_request( ssl_context *ssl )
{
- const unsigned char *p = ssl->in_msg + 4;
+ const unsigned char *p = ssl->in_msg + ssl_hs_hdr_len( ssl );
int major_ver, minor_ver;
unsigned char cookie_len;
@@ -1069,8 +1069,6 @@
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
}
- ssl_hs_rm_dtls_hdr( ssl );
-
#if defined(POLARSSL_SSL_PROTO_DTLS)
if( ssl->transport == SSL_TRANSPORT_DATAGRAM )
{
@@ -1090,6 +1088,8 @@
}
#endif /* POLARSSL_SSL_PROTO_DTLS */
+ ssl_hs_rm_dtls_hdr( ssl );
+
if( ssl->in_hslen < 42 ||
buf[0] != SSL_HS_SERVER_HELLO )
{