Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Roshan Khatri <[email protected]>
  • Loading branch information
roshkhatri committed Jul 23, 2024
1 parent c2e5c26 commit 7fb234b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7fb234b

Please sign in to comment.