All IP string repr buffers are now REDIS_IP_STR_LEN bytes.

This commit is contained in:
antirez 2013-07-09 11:32:52 +02:00
parent 2e75d3947c
commit a7451c1b6d
3 changed files with 4 additions and 5 deletions

View File

@ -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);
@ -1206,8 +1206,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);

View File

@ -2360,7 +2360,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;

View File

@ -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];