Fix right-shift data loss issue with MBEDTLS_PUT_UINT16_BE in cookie

Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
This commit is contained in:
XiaokangQian 2022-02-08 05:56:34 +00:00
parent 233397ef88
commit 5e3c947841

View file

@ -713,7 +713,7 @@ static int ssl_tls13_write_cookie_ext( mbedtls_ssl_context *ssl,
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_COOKIE, p, 0 );
MBEDTLS_PUT_UINT16_BE( ssl->handshake->verify_cookie_len + 2, p, 2 );
MBEDTLS_PUT_UINT16_BE( ssl->handshake->verify_cookie_len, p, 4 );
MBEDTLS_PUT_UINT16_BE( (size_t) ssl->handshake->verify_cookie_len, p, 4 );
p += 6;
/* Cookie */