diff --git a/src/cluster.c b/src/cluster.c index 7531ab7c..e60d82a6 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -758,7 +758,7 @@ void nodeIp2String(char *buf, clusterLink *link) { if (getpeername(link->fd, (struct sockaddr*) &sa, &salen) == -1) redisPanic("getpeername() failed."); - inet_ntop(sa.sin_family,(void*)&(sa.sin_addr),buf,sizeof(link->node->ip)); + inet_ntop(sa.sin_family,(void*)&(sa.sin_addr),buf,16); } @@ -2084,7 +2084,7 @@ void clusterCommand(redisClient *c) { /* Finally add the node to the cluster with a random name, this * will get fixed in the first handshake (ping/pong). */ n = createClusterNode(NULL,REDIS_NODE_HANDSHAKE|REDIS_NODE_MEET); - inet_ntop(sa.sin_family,(void*)&(sa.sin_addr),n->ip,sizeof(n->ip)); + inet_ntop(sa.sin_family,(void*)&(sa.sin_addr),n->ip,16); n->port = port; clusterAddNode(n); addReply(c,shared.ok);