fix invalid memory access after realloc() for statsd tcp connections
Costa Tsaousis (ktsaou) committed
Jun 23, 2017 at 00:22 UTC
6124d003606314ecbc14497e8d88fdd6fee33ebe
1 file changed
+4
src/socket.c
+4
@@ -1078,6 +1078,10 @@ void poll_events(LISTEN_SOCKETS *sockets
1078
// accept ok
1079
info("POLLFD: LISTENER: client '[%s]:%s' connected to '%s'", client_ip, client_port, sockets->fds_names[i]);
1080
poll_add_fd(&p, nfd, SOCK_STREAM, POLLIN, POLLINFO_FLAG_CLIENT_SOCKET);
1081
+
1082
+ // it may have realloced them, so refresh our pointers
1083
+ pf = &p.fds[i];
1084
+ pi = &p.inf[i];
1085
}
1086
} while (nfd != -1);
1087
break;