summaryrefslogtreecommitdiff
path: root/libgo/go/net/hosts.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/net/hosts.go')
-rw-r--r--libgo/go/net/hosts.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/libgo/go/net/hosts.go b/libgo/go/net/hosts.go
index c4de1b6a97..9c101c6ef5 100644
--- a/libgo/go/net/hosts.go
+++ b/libgo/go/net/hosts.go
@@ -110,7 +110,9 @@ func lookupStaticHost(host string) []string {
lowerHost := []byte(host)
lowerASCIIBytes(lowerHost)
if ips, ok := hosts.byName[absDomainName(lowerHost)]; ok {
- return ips
+ ipsCp := make([]string, len(ips))
+ copy(ipsCp, ips)
+ return ipsCp
}
}
return nil
@@ -127,7 +129,9 @@ func lookupStaticAddr(addr string) []string {
}
if len(hosts.byAddr) != 0 {
if hosts, ok := hosts.byAddr[addr]; ok {
- return hosts
+ hostsCp := make([]string, len(hosts))
+ copy(hostsCp, hosts)
+ return hostsCp
}
}
return nil