Skip to content

Commit

Permalink
Merge pull request cesanta#183 from cesanta/fix_176
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Mikulicic committed Dec 21, 2014
2 parents 8cede17 + f804e4f commit 942d51d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fossa.c
Original file line number Diff line number Diff line change
Expand Up @@ -4457,6 +4457,16 @@ static int ns_get_ip_address_of_nameserver(char *name, size_t name_len) {
&type, value, &len) == ERROR_SUCCESS ||
RegQueryValueEx(hSub, "DhcpNameServer", 0,
&type, value, &len) == ERROR_SUCCESS)) {
/*
* See https://github.com/cesanta/fossa/issues/176
* The value taken from the registry can be empty, a single
* IP address, or multiple IP addresses separated by comma.
* If it's multiple IP addresses, take the first one.
*/
char *comma = strchr(value, ',');
if (comma != NULL) {
*comma = '\0';
}
strncpy(name, value, name_len);
ret++;
RegCloseKey(hSub);
Expand Down
10 changes: 10 additions & 0 deletions src/resolv.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ static int ns_get_ip_address_of_nameserver(char *name, size_t name_len) {
&type, value, &len) == ERROR_SUCCESS ||
RegQueryValueEx(hSub, "DhcpNameServer", 0,
&type, value, &len) == ERROR_SUCCESS)) {
/*
* See https://github.com/cesanta/fossa/issues/176
* The value taken from the registry can be empty, a single
* IP address, or multiple IP addresses separated by comma.
* If it's multiple IP addresses, take the first one.
*/
char *comma = strchr(value, ',');
if (comma != NULL) {
*comma = '\0';
}
strncpy(name, value, name_len);
ret++;
RegCloseKey(hSub);
Expand Down

0 comments on commit 942d51d

Please sign in to comment.