Merge pull request #2472 from Kelimion/resolv_fix

Fix #2471
This commit is contained in:
Jeroen van Rijn
2023-04-21 10:04:27 +02:00
committed by GitHub

View File

@@ -373,18 +373,20 @@ load_resolv_conf :: proc(resolv_conf_path: string, allocator := context.allocato
defer delete(res)
resolv_str := string(res)
id_str := "nameserver"
id_len := len(id_str)
_name_servers := make([dynamic]Endpoint, 0, allocator)
for line in strings.split_lines_iterator(&resolv_str) {
if len(line) == 0 || line[0] == '#' {
continue
}
id_str := "nameserver"
if strings.compare(line[:len(id_str)], id_str) != 0 {
if len(line) < id_len || strings.compare(line[:id_len], id_str) != 0 {
continue
}
server_ip_str := strings.trim_left_space(line[len(id_str):])
server_ip_str := strings.trim_left_space(line[id_len:])
if len(server_ip_str) == 0 {
continue
}