From 51c485f52327675718b227fc5d9f8e78d8bdebd9 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 8 Oct 2013 14:59:59 -0700 Subject: [PATCH] 1. Added a couple missing checks for NULL pointers in DTLS code. 2. Fixed compiler warning under Windows. --- src/internal.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/internal.c b/src/internal.c index 7f783240b..f6a287ed1 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2073,8 +2073,10 @@ DtlsMsg* DtlsMsgStore(DtlsMsg* head, word32 seq, const byte* data, DtlsMsg* cur = DtlsMsgFind(head, seq); if (cur == NULL) { cur = DtlsMsgNew(dataSz, heap); - DtlsMsgSet(cur, seq, data, type, fragOffset, fragSz); - head = DtlsMsgInsert(head, cur); + if (cur != NULL) { + DtlsMsgSet(cur, seq, data, type, fragOffset, fragSz); + head = DtlsMsgInsert(head, cur); + } } else { DtlsMsgSet(cur, seq, data, type, fragOffset, fragSz); @@ -3742,7 +3744,8 @@ static int DoDtlsHandShakeMsg(CYASSL* ssl, byte* input, word32* inOutIdx, size, type, fragOffset, fragSz, ssl->heap); *inOutIdx += fragSz; ret = 0; - if (ssl->dtls_msg_list->fragSz >= ssl->dtls_msg_list->sz) + if (ssl->dtls_msg_list != NULL && + ssl->dtls_msg_list->fragSz >= ssl->dtls_msg_list->sz) ret = DtlsMsgDrain(ssl); } else { @@ -7654,6 +7657,8 @@ static void PickHashSigAlgo(CYASSL* ssl, int ret = 0; byte doUserRsa = 0; + (void)doUserRsa; + #ifdef HAVE_PK_CALLBACKS #ifndef NO_RSA if (ssl->ctx->RsaEncCb)