struct sockaddr_un *soun = &nd->addr_un;
soun->sun_family = AF_UNIX;
- strcpy(soun->sun_path, path);
+ memset(soun->sun_path, 0, sizeof(soun->sun_path));
+ strncpy(soun->sun_path, path, sizeof(soun->sun_path) - 1);
return 0;
}
memset(addr, 0, sizeof(*addr));
addr->sun_family = AF_UNIX;
- strcpy(addr->sun_path, path);
+ strncpy(addr->sun_path, path, sizeof(addr->sun_path) - 1);
unlink(path);
len = sizeof(addr->sun_family) + strlen(path) + 1;
struct netio_options *o = td->eo;
struct ip_mreq mr;
struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
struct sockaddr *saddr;
int fd, opt, type, domain;
socklen_t len;
memset(&sin, 0, sizeof(sin));
- memset(&sin6, 0, sizeof(sin6));
if (o->proto == FIO_TYPE_TCP) {
type = SOCK_STREAM;
len = sizeof(nd->addr6);
nd->addr6.sin6_family = AF_INET6;
- nd->addr6.sin6_addr = sin6.sin6_addr.s6_addr ? sin6.sin6_addr : in6addr_any;
+ nd->addr6.sin6_addr = in6addr_any;
nd->addr6.sin6_port = htons(port);
}
if (bind(fd, saddr, len) < 0) {
+ close(fd);
td_verror(td, errno, "bind");
return 1;
}