Merge pull request #312 from ejohnstown/fuzz

Fuzz
pull/313/head
JacobBarthelmeh 2021-01-27 18:48:46 +07:00 committed by GitHub
commit 3711e6a7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -2843,6 +2843,13 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
if (ret == WS_SUCCESS && ssh->handshake->kexId == ID_DH_GEX_SHA256) {
byte primeGroupPad = 0, generatorPad = 0;
if (ssh->handshake->primeGroup == NULL ||
ssh->handshake->generator == NULL) {
WLOG(WS_LOG_DEBUG,
"DKDR: trying GEX without generator or prime group");
ret = WS_BAD_ARGUMENT;
}
/* Hash in the client's requested minimum key size. */
if (ret == 0) {
c32toa(ssh->handshake->dhGexMinSz, scratchLen);
@ -6345,6 +6352,12 @@ int SendKexInit(WOLFSSH* ssh)
ssh->outputBuffer.length = idx;
if (ssh->handshake->kexInit != NULL) {
WFREE(ssh->handshake->kexInit, ssh->ctx->heap, DYNTYPE_STRING);
ssh->handshake->kexInit = NULL;
ssh->handshake->kexInitSz = 0;
}
buf = (byte*)WMALLOC(bufSz, ssh->ctx->heap, DYNTYPE_STRING);
if (buf == NULL) {
WLOG(WS_LOG_DEBUG, "Cannot allocate storage for KEX Init msg");