diff --git a/mongoose.c b/mongoose.c index 70ea311e..241cbe2c 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2708,8 +2708,8 @@ static int mg_resolve2(const char *host, struct in_addr *ina) { return 0; } for (p = servinfo; p != NULL; p = p->ai_next) { - memcpy(&h, &p->ai_addr, sizeof(struct sockaddr_in *)); - memcpy(ina, &h->sin_addr, sizeof(ina)); + memcpy(&h, &p->ai_addr, sizeof(h)); + memcpy(ina, &h->sin_addr, sizeof(*ina)); } freeaddrinfo(servinfo); return 1; diff --git a/src/mg_net.c b/src/mg_net.c index a4bcd781..12c1b17c 100644 --- a/src/mg_net.c +++ b/src/mg_net.c @@ -341,8 +341,8 @@ static int mg_resolve2(const char *host, struct in_addr *ina) { return 0; } for (p = servinfo; p != NULL; p = p->ai_next) { - memcpy(&h, &p->ai_addr, sizeof(struct sockaddr_in *)); - memcpy(ina, &h->sin_addr, sizeof(ina)); + memcpy(&h, &p->ai_addr, sizeof(h)); + memcpy(ina, &h->sin_addr, sizeof(*ina)); } freeaddrinfo(servinfo); return 1;