[PATCH 2/3] ssl: Fix memcmp() IPv6 address size

Kevin Cernekee cernekee at gmail.com
Sat Dec 6 23:01:20 PST 2014


clang spotted the misplaced parentheses:

    ssl.c:120:72: warning: size argument in 'memcmp' call is a comparison
          [-Wmemsize-comparison]
      ...!memcmp(&a6->sin6_addr, &b6->sin6_addr, sizeof(a6->sin6_addr) &&
                                                 ~~~~~~~~~~~~~~~~~~~~~~^~

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 ssl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ssl.c b/ssl.c
index d47a819..d22ebd3 100644
--- a/ssl.c
+++ b/ssl.c
@@ -117,8 +117,8 @@ static int match_sockaddr(struct sockaddr *a, struct sockaddr *b)
 	} else if (a->sa_family == AF_INET6) {
 		struct sockaddr_in6 *a6 = (void *)a;
 		struct sockaddr_in6 *b6 = (void *)b;
-		return !memcmp(&a6->sin6_addr, &b6->sin6_addr, sizeof(a6->sin6_addr) &&
-			       a6->sin6_port == b6->sin6_port);
+		return !memcmp(&a6->sin6_addr, &b6->sin6_addr, sizeof(a6->sin6_addr)) &&
+		       a6->sin6_port == b6->sin6_port;
 	} else
 		return 0;
 }
-- 
2.1.1




More information about the openconnect-devel mailing list