set host[0] = 0 at the beginning for more safety

This commit is contained in:
FRIGN 2014-08-13 19:37:36 +02:00
parent 8001703f50
commit 411705dfc0

View file

@ -461,6 +461,7 @@ serve(int fd) {
close(fd); close(fd);
/* get host */ /* get host */
host[0] = 0;
switch(sa.sa_family) { switch(sa.sa_family) {
case AF_INET: case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)&sa)->sin_addr), inet_ntop(AF_INET, &(((struct sockaddr_in *)&sa)->sin_addr),
@ -470,8 +471,6 @@ serve(int fd) {
inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)&sa)->sin6_addr), inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)&sa)->sin6_addr),
host, sizeof host); host, sizeof host);
break; break;
default:
host[0] = 0;
} }
result = request(); result = request();