Skip to content

Commit bd75cb4

Browse files
ejohnstownpadelsbach
authored andcommitted
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 822c09d commit bd75cb4

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
@@ -13478,7 +13478,7 @@ int SendKexDhGexGroup(WOLFSSH* ssh)
1347813478
int ret = WS_SUCCESS;
1347913479

1348013480
WLOG(WS_LOG_DEBUG, "Entering SendKexDhGexGroup()");
13481-
if (ssh == NULL)
13481+
if (ssh == NULL || ssh->handshake == NULL)
1348213482
ret = WS_BAD_ARGUMENT;
1348313483

1348413484
if (ret == WS_SUCCESS) {
@@ -13525,8 +13525,11 @@ int SendKexDhGexGroup(WOLFSSH* ssh)
1352513525
ret = BundlePacket(ssh);
1352613526
}
1352713527

13528-
if (ret == WS_SUCCESS)
13528+
if (ret == WS_SUCCESS) {
13529+
WLOG_EXPECT_MSGID(MSGID_KEXDH_GEX_INIT);
13530+
ssh->handshake->expectMsgId = MSGID_KEXDH_GEX_INIT;
1352913531
ret = wolfSSH_SendPacket(ssh);
13532+
}
1353013533

1353113534
WLOG(WS_LOG_DEBUG, "Leaving SendKexDhGexGroup(), ret = %d", ret);
1353213535
return ret;

0 commit comments

Comments
 (0)