server: Return error on address lookup fails.

This corrects an issue introduced by commit
e8f63bc295 where a failure to lookup a
hostname could lead to a panic in certain circumstances.  An error is
now returned in that case as expected.
This commit is contained in:
Dave Collins 2016-11-11 20:49:22 -06:00
parent 089611a61b
commit 0d4546c965
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2

View file

@ -2516,6 +2516,9 @@ func addrStringToNetAddr(addr string) (net.Addr, error) {
if err != nil {
return nil, err
}
if len(ips) == 0 {
return nil, fmt.Errorf("no addresses found for %s", host)
}
port, err := strconv.Atoi(strPort)
if err != nil {