Commit 9125830d authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Cesanta Bot

Fix stkovf in mg_resolve_async_opt

PUBLISHED_FROM=8e37c51c6b0bf7d0782f3a997360827471b95d2e
parent 55963d0c
...@@ -10414,9 +10414,9 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) { ...@@ -10414,9 +10414,9 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) {
} else { } else {
/* Try to figure out what nameserver to use */ /* Try to figure out what nameserver to use */
for (ret = -1; fgets(line, sizeof(line), fp) != NULL;) { for (ret = -1; fgets(line, sizeof(line), fp) != NULL;) {
char buf[256]; unsigned int a, b, c, d;
if (sscanf(line, "nameserver %255[^\n\t #]s", buf) == 1) { if (sscanf(line, "nameserver %u.%u.%u.%u", &a, &b, &c, &d) == 4) {
snprintf(name, name_len, "udp://%s:53", buf); snprintf(name, name_len, "udp://%u.%u.%u.%u:53", a, b, c, d);
ret = 0; ret = 0;
break; break;
} }
......
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