summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-07-09 11:32:52 +0200
committerantirez <antirez@gmail.com>2013-07-09 11:32:52 +0200
commit631d656a94bdc8e23bcfaad3e64cb8210cc03aa9 (patch)
tree9fc7a750d465132833e5a6ff51a1151e35bce669
parentf19e267e9a422e2c791489e5d46ec16e966f55d6 (diff)
downloadredis-631d656a94bdc8e23bcfaad3e64cb8210cc03aa9.tar.gz
All IP string repr buffers are now REDIS_IP_STR_LEN bytes.
-rw-r--r--src/cluster.c2
-rw-r--r--src/networking.c5
-rw-r--r--src/redis.c2
-rw-r--r--src/sentinel.c2
4 files changed, 5 insertions, 6 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 195cfe5d7..76ab67112 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -306,7 +306,7 @@ void freeClusterLink(clusterLink *link) {
void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
int cport, cfd;
- char cip[128]; /* Could use INET6_ADDRSTRLEN here, but its smaller */
+ char cip[REDIS_IP_STR_LEN];
clusterLink *link;
REDIS_NOTUSED(el);
REDIS_NOTUSED(mask);
diff --git a/src/networking.c b/src/networking.c
index b220055f1..59f056436 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -552,7 +552,7 @@ static void acceptCommonHandler(int fd, int flags) {
void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
int cport, cfd;
- char cip[128]; /* Could use INET6_ADDRSTRLEN here, but its smaller */
+ char cip[REDIS_IP_STR_LEN];
REDIS_NOTUSED(el);
REDIS_NOTUSED(mask);
REDIS_NOTUSED(privdata);
@@ -1210,8 +1210,7 @@ void clientCommand(redisClient *c) {
} else if (!strcasecmp(c->argv[1]->ptr,"kill") && c->argc == 3) {
listRewind(server.clients,&li);
while ((ln = listNext(&li)) != NULL) {
- /* addr size 64 > INET6_ADDRSTRLEN + : + strlen("65535") */
- char ip[INET6_ADDRSTRLEN], addr[64];
+ char ip[REDIS_IP_STR_LEN], addr[REDIS_IP_STR_LEN+64];
int port;
client = listNodeValue(ln);
diff --git a/src/redis.c b/src/redis.c
index a2bcdd6d0..11c69629e 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -2435,7 +2435,7 @@ sds genRedisInfoString(char *section) {
while((ln = listNext(&li))) {
redisClient *slave = listNodeValue(ln);
char *state = NULL;
- char ip[INET6_ADDRSTRLEN];
+ char ip[REDIS_IP_STR_LEN];
int port;
long lag = 0;
diff --git a/src/sentinel.c b/src/sentinel.c
index e89199fec..eb729966a 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -1837,7 +1837,7 @@ void sentinelPingInstance(sentinelRedisInstance *ri) {
(now - ri->last_pub_time) > SENTINEL_PUBLISH_PERIOD)
{
/* PUBLISH hello messages only to masters. */
- char ip[INET6_ADDRSTRLEN];
+ char ip[REDIS_IP_STR_LEN];
if (anetSockName(ri->cc->c.fd,ip,sizeof(ip),NULL) != -1) {
char myaddr[128];