Commit 3fc61a3e authored by Sergey Lyubka's avatar Sergey Lyubka Committed by Cesanta Bot

Fix mg_resolve2()

PUBLISHED_FROM=b0df728a75073c6ea9fc1984bb6a6b463f539347
parent 1fb9f922
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment