1
0
forked from aniani/gmnisrv

Fix size of in{,6}_addr

This commit is contained in:
Drew DeVault 2020-09-26 17:33:13 -04:00
parent 814a6e7657
commit 534efe8e34

View File

@ -48,14 +48,14 @@ server_init(struct gmnisrv_server *server, struct gmnisrv_config *conf)
if (b->family == AF_INET) {
struct sockaddr_in in = {0};
in.sin_family = AF_INET;
memcpy(&in.sin_addr, b->addr, sizeof(b->addr));
memcpy(&in.sin_addr, b->addr, sizeof(struct in_addr));
in.sin_port = htons(b->port);
addr = (struct sockaddr *)∈
addrsz = sizeof(in);
} else if (b->family == AF_INET6) {
struct sockaddr_in6 in = {0};
in.sin6_family = AF_INET6;
memcpy(&in.sin6_addr, b->addr, sizeof(b->addr));
memcpy(&in.sin6_addr, b->addr, sizeof(struct in6_addr));
in.sin6_port = htons(b->port);
addr = (struct sockaddr *)∈
addrsz = sizeof(in);