Merge pull request #6823 from rizlik/stale_suites_fix

fix: tls13: don't use stale suites pointers in CheckPreSharedKeys
This commit is contained in:
JacobBarthelmeh
2023-10-03 11:41:53 -06:00
committed by GitHub

View File

@@ -6064,7 +6064,7 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
int first = 0; int first = 0;
#ifndef WOLFSSL_PSK_ONE_ID #ifndef WOLFSSL_PSK_ONE_ID
int i; int i;
const Suites* suites = WOLFSSL_SUITES(ssl); const Suites* suites;
#else #else
byte suite[2]; byte suite[2];
#endif #endif
@@ -6102,7 +6102,8 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
/* Refine list for PSK processing. */ /* Refine list for PSK processing. */
RefineSuites(ssl, clSuites); RefineSuites(ssl, clSuites);
/* set after refineSuites, to avoid taking a stale ptr to ctx->Suites */
suites = WOLFSSL_SUITES(ssl);
#ifndef WOLFSSL_PSK_ONE_ID #ifndef WOLFSSL_PSK_ONE_ID
if (usingPSK == NULL) if (usingPSK == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;