[PATCH 1/6] dtls: Fix memcmp() arguments in MTU detection code
Kevin Cernekee
cernekee at gmail.com
Thu Apr 14 23:06:00 PDT 2016
Fix the length argument and return value checks. Caught by clang
warnings.
Signed-off-by: Kevin Cernekee <cernekee at 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
More information about the openconnect-devel
mailing list