[PATCH V2 1/6] dtls: Fix memcmp() arguments in MTU detection code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 a1a5a720bced..3b9cbbe7a5bb 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;
-- 
2.8.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux