From a58d26f12529f40598bfb66f1578b49913d4c180 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Fri, 24 Aug 2018 15:25:34 +0500 Subject: [PATCH] src/Cedar/IPsec_IKE.c: resolve null pointer dereference found by coverity, remove unused variable [src/Cedar/IPsec_IKE.c:4332] -> [src/Cedar/IPsec_IKE.c:4332]: (style) Same expression on both sides of '||'. [src/Cedar/IPsec_IKE.c:1665]: (style) Variable 'zero' is assigned a value that is never used. --- src/Cedar/IPsec_IKE.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Cedar/IPsec_IKE.c b/src/Cedar/IPsec_IKE.c index dfe56168..a35d8467 100644 --- a/src/Cedar/IPsec_IKE.c +++ b/src/Cedar/IPsec_IKE.c @@ -1662,7 +1662,6 @@ void StartQuickMode(IKE_SERVER *ike, IKE_CLIENT *c) UINT spi; UINT spi_be; UCHAR hash1[IKE_MAX_HASH_SIZE]; - UCHAR zero = 0; DH_CTX *dh = NULL; UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; @@ -3842,6 +3841,10 @@ bool IkeIsVendorIdExists(IKE_PACKET *p, char *str) for (i = 0;i < num;i++) { IKE_PACKET_PAYLOAD *payload = IkeGetPayload(p->PayloadList, IKE_PAYLOAD_VENDOR_ID, i); + if (payload == NULL) + { + return false; + } if (CompareBuf(payload->Payload.VendorId.Data, buf)) { @@ -4325,7 +4328,7 @@ IKE_CLIENT *SearchOrCreateNewIkeClientForIkePacket(IKE_SERVER *ike, IP *client_i { IKE_CLIENT *c; // Validate arguments - if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0 || pr == NULL) + if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) { return NULL; }