Ensure extensions are only parsed once

This commit is contained in:
Lealem Amedie
2024-06-06 14:10:56 -06:00
parent 7cc0ac14c4
commit 3de358ef06

View File

@ -5324,8 +5324,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
/* restore message type */
*extMsgType = args->extMsgType;
if (args->totalExtSz > 0) {
/* Parse and handle extensions. */
/* Parse and handle extensions, unless lower than TLS1.3. In that case,
* extensions will be parsed in DoServerHello. */
if (args->totalExtSz > 0 && IsAtLeastTLSv1_3(ssl->version)) {
ret = TLSX_Parse(ssl, input + args->idx, args->totalExtSz,
*extMsgType, NULL);
if (ret != 0) {
@ -5344,7 +5345,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
ssl->msgsReceived.got_hello_retry_request = 1;
ssl->msgsReceived.got_server_hello = 0;
}
}
if (args->totalExtSz > 0) {
args->idx += args->totalExtSz;
}