diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-04-21 08:35:21 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-04-21 08:35:21 +0200 |
| commit | 9a982cc5b5ecc16371f6727f67adc0455ebd7620 (patch) | |
| tree | 8e232acfd0cdfbf6dd1fcee11228203d74f7071e /core/net/dns.odin | |
| parent | b2b88f1d99c497f152485869b3f155b965e813bc (diff) | |
Fix #2471
Diffstat (limited to 'core/net/dns.odin')
| -rw-r--r-- | core/net/dns.odin | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/net/dns.odin b/core/net/dns.odin index f5bf912bc..a0223e6ee 100644 --- a/core/net/dns.odin +++ b/core/net/dns.odin @@ -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 } |