From 7fb234b2af5f945590517fd4ca65b29e1a7ec095 Mon Sep 17 00:00:00 2001 From: Roshan Khatri Date: Tue, 23 Jul 2024 05:33:12 +0000 Subject: [PATCH] Address feedback Signed-off-by: Roshan Khatri --- src/cluster_legacy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 6431ab62ef..6284178e9d 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -3583,7 +3583,8 @@ void clusterLinkConnectHandler(connection *conn) { serverLog(LL_DEBUG, "Connecting with Node %.40s at %s:%d", node->name, node->ip, node->cport); } -static inline int isSigAndMsgLenValid(clusterMsg *hdr) { +/* Performs sanity check on the message signature and length depending on the type. */ +static inline int isClusterMsgSignatureAndLengthValid(clusterMsg *hdr) { if (memcmp(hdr->sig, "RCmb", 4) != 0) return 0; uint16_t type = ntohs(hdr->type); uint32_t totlen = ntohl(hdr->totlen); @@ -3614,7 +3615,7 @@ void clusterReadHandler(connection *conn) { if (rcvbuflen == RCVBUF_MIN_READ_LEN) { /* Perform some sanity check on the message signature * and length. */ - if (!isSigAndMsgLenValid(hdr)) { + if (!isClusterMsgSignatureAndLengthValid(hdr)) { char ip[NET_IP_STR_LEN]; int port; if (connAddrPeerName(conn, ip, sizeof(ip), &port) == -1) {