Merge pull request #115 from JacobBarthelmeh/fuzz

additional sanity checks
pull/116/head
John Safranek 2018-11-15 14:44:57 -08:00 committed by GitHub
commit 3b276aaae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -2331,7 +2331,8 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
}
/* Add a pad byte if the mpint has the MSB set. */
if (ret == 0) {
if (ssh->handshake->primeGroup[0] & 0x80)
if (ssh->handshake->primeGroup != NULL &&
ssh->handshake->primeGroup[0] & 0x80)
primeGroupPad = 1;
/* Hash in the length of the GEX prime group. */

View File

@ -496,6 +496,10 @@ int wolfSSH_connect(WOLFSSH* ssh)
/* no break */
case CONNECT_SERVER_KEXINIT_DONE:
if (ssh->handshake == NULL) {
return WS_FATAL_ERROR;
}
if (ssh->handshake->kexId == ID_DH_GEX_SHA256)
ssh->error = SendKexDhGexRequest(ssh);
else