Skip to content

Commit ed64d8d

Browse files
stricter NULL checks
1 parent 6de9855 commit ed64d8d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/internal.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16858,10 +16858,12 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
1685816858
ssl->echConfigs != NULL &&
1685916859
!ssl->options.echAccepted) {
1686016860
TLSX* echX = TLSX_Find(ssl->extensions, TLSX_ECH);
16861-
if (echX != NULL) {
16861+
if (echX != NULL && echX->data != NULL) {
1686216862
WOLFSSL_ECH* ech = (WOLFSSL_ECH*)echX->data;
16863-
domainName = ech->echConfig ?
16864-
ech->echConfig->publicName : NULL;
16863+
if (ech->echConfig != NULL &&
16864+
ech->echConfig->publicName != NULL) {
16865+
domainName = ech->echConfig->publicName;
16866+
}
1686516867
}
1686616868
}
1686716869
#endif

src/tls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13771,12 +13771,12 @@ static int TLSX_ECH_CheckInnerPadding(WOLFSSL* ssl, WOLFSSL_ECH* ech)
1377113771
byte acc = 0;
1377213772
word32 i;
1377313773

13774-
(void)ssl;
13775-
1377613774
#ifdef WOLFSSL_DTLS13
1377713775
headerSz = ssl->options.dtls ? DTLS13_HANDSHAKE_HEADER_SZ :
1377813776
HANDSHAKE_HEADER_SZ;
1377913777
#else
13778+
(void)ssl;
13779+
1378013780
headerSz = HANDSHAKE_HEADER_SZ;
1378113781
#endif
1378213782

tests/api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15132,6 +15132,10 @@ static int test_wolfSSL_Tls13_ECH_rejected_empty_client_cert(void)
1513215132
"ech-private.com", (word16)XSTRLEN("ech-private.com")),
1513315133
WOLFSSL_SUCCESS);
1513415134

15135+
wolfSSL_set_verify(test_ctx.s_ssl,
15136+
WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
15137+
wolfSSL_set_verify(test_ctx.c_ssl, WOLFSSL_VERIFY_PEER, NULL);
15138+
1513515139
/* Disable ECH on the server so ECH is rejected */
1513615140
wolfSSL_SetEchEnable(test_ctx.s_ssl, 0);
1513715141

0 commit comments

Comments
 (0)