Skip to content

Commit 6c394c1

Browse files
committed
Pin expectMsgId after KEXDH_GEX_GROUP
- Set expectMsgId to MSGID_KEXDH_GEX_INIT so the server rejects any other KEX message at this stage (RFC 4419 sec 3). - Reject NULL ssh->handshake in the entry check now that the success path dereferences it. Issue: F-3668
1 parent 5905e83 commit 6c394c1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/internal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13476,7 +13476,7 @@ int SendKexDhGexGroup(WOLFSSH* ssh)
1347613476
int ret = WS_SUCCESS;
1347713477

1347813478
WLOG(WS_LOG_DEBUG, "Entering SendKexDhGexGroup()");
13479-
if (ssh == NULL)
13479+
if (ssh == NULL || ssh->handshake == NULL)
1348013480
ret = WS_BAD_ARGUMENT;
1348113481

1348213482
if (ret == WS_SUCCESS) {
@@ -13523,8 +13523,11 @@ int SendKexDhGexGroup(WOLFSSH* ssh)
1352313523
ret = BundlePacket(ssh);
1352413524
}
1352513525

13526-
if (ret == WS_SUCCESS)
13526+
if (ret == WS_SUCCESS) {
13527+
WLOG_EXPECT_MSGID(MSGID_KEXDH_GEX_INIT);
13528+
ssh->handshake->expectMsgId = MSGID_KEXDH_GEX_INIT;
1352713529
ret = wolfSSH_SendPacket(ssh);
13530+
}
1352813531

1352913532
WLOG(WS_LOG_DEBUG, "Leaving SendKexDhGexGroup(), ret = %d", ret);
1353013533
return ret;

0 commit comments

Comments
 (0)