From cae085b6762d054e44c07680d7eae4324325d731 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Thu, 29 May 2014 16:20:01 -0700 Subject: [PATCH] msg_types.h: Don't use strncmp for comparing sockaddr_in. Fixes: #8472 Signed-off-by: Dan Mick --- src/msg/msg_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 5d86b3a229e..d259e528947 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -27,10 +27,10 @@ namespace ceph { } inline bool operator==(const sockaddr_in& a, const sockaddr_in& b) { - return strncmp((const char*)&a, (const char*)&b, sizeof(a)) == 0; + return memcmp((const char*)&a, (const char*)&b, sizeof(a)) == 0; } inline bool operator!=(const sockaddr_in& a, const sockaddr_in& b) { - return strncmp((const char*)&a, (const char*)&b, sizeof(a)) != 0; + return memcmp((const char*)&a, (const char*)&b, sizeof(a)) != 0; } extern ostream& operator<<(ostream& out, const sockaddr_storage &ss);