From c67d9ee2019eec133a93d2ae531c4586a8889d57 Mon Sep 17 00:00:00 2001 From: Evengard Date: Thu, 2 Feb 2023 16:00:43 +0300 Subject: [PATCH] Fixing up coverity report flags from #1760 and #1761 --- src/Cedar/Proto_PPP.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Cedar/Proto_PPP.c b/src/Cedar/Proto_PPP.c index 3c9d845f..e90c9700 100644 --- a/src/Cedar/Proto_PPP.c +++ b/src/Cedar/Proto_PPP.c @@ -1269,7 +1269,7 @@ bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req char hubname[MAX_SIZE]; HUB *hub; bool found = false; - UINT authtype; + UINT authtype = AUTHTYPE_ANONYMOUS; UCHAR eapidentitypkt[MAX_SIZE] = { 0 }; WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); @@ -1278,6 +1278,7 @@ bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req switch (eap_packet->Type) { case PPP_EAP_TYPE_IDENTITY: + p->Eap_MatchUserByCert = false; // Parse username Copy(eapidentitypkt, eap_packet->Data, MIN(MAX_SIZE, eap_datasize)); @@ -3428,6 +3429,11 @@ bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapSize) UCHAR flags = PPP_EAP_TLS_FLAG_NONE; UINT sizeLeft = 0; Debug("Got EAP-TLS size=%i\n", eapSize); + if (eapSize == 0) + { + // This is a broken packet without flags, ignore it + return false; + } if (eapSize == 1 && eap_packet->Tls.Flags == PPP_EAP_TLS_FLAG_NONE) { // This is an EAP-TLS message ACK @@ -3507,7 +3513,7 @@ bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapSize) } dataBuffer = eap_packet->Tls.TlsDataWithoutLength; dataSize = eapSize - 1; - if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) + if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_TLS_LENGTH && dataSize >= 4) { dataBuffer = eap_packet->Tls.TlsDataWithLength.Data; dataSize -= 4;