blob: 90ebb5bf339b0bc44f6235277ca4ac65671f1f06 [file] [log] [blame]
From a99cb8f503f3f31f6bf31dc7762d41ebb4f933f6 Mon Sep 17 00:00:00 2001
From: Kevin Cernekee <cernekee@gmail.com>
Date: Thu, 14 Apr 2016 22:14:26 -0700
Subject: [PATCH 2/8] dtls: Fix memcmp() arguments in MTU detection code
Fix the length argument and return value checks. Caught by clang
warnings.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
dtls.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dtls.c b/dtls.c
index a1a5a72..3b9cbbe 100644
--- a/dtls.c
+++ b/dtls.c
@@ -1170,7 +1170,7 @@ static int detect_mtu_ipv4(struct openconnect_info *vpninfo, unsigned char *buf)
goto fail;
} while(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
- if (ret > 0 && (buf[0] != AC_PKT_DPD_RESP || memcmp(&buf[1], id, sizeof(buf) != 0))) {
+ if (ret > 0 && (buf[0] != AC_PKT_DPD_RESP || memcmp(&buf[1], id, sizeof(id)) != 0)) {
vpn_progress(vpninfo, PRG_DEBUG,
_("Received unexpected packet (%.2x) in MTU detection; skipping.\n"), (unsigned)buf[0]);
goto reread; /* resend */
@@ -1255,7 +1255,7 @@ static int detect_mtu_ipv6(struct openconnect_info *vpninfo, unsigned char *buf)
continue;
/* something unexpected was received, let's ignore it */
- if (ret > 0 && (buf[0] != AC_PKT_DPD_RESP || memcmp(&buf[1], id, sizeof(buf) != 0))) {
+ if (ret > 0 && (buf[0] != AC_PKT_DPD_RESP || memcmp(&buf[1], id, sizeof(id)) != 0)) {
vpn_progress(vpninfo, PRG_DEBUG,
_("Received unexpected packet (%.2x) in MTU detection; skipping.\n"), (unsigned)buf[0]);
goto reread;
--
1.9.1