1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:44:39 -07:00

net/mail: To4 is all we need

This commit is contained in:
Cassondra Foesch 2024-09-17 12:24:56 +00:00
parent 18675e7046
commit dfa5f640b0

View File

@ -756,7 +756,7 @@ func (p *addrParser) consumeDomainLiteral() (string, error) {
return "", fmt.Errorf("mail: invalid IPv6 address in domain-literal: %q", dtext)
}
} else if len(net.ParseIP(dtext).To4()) != net.IPv4len {
} else if net.ParseIP(dtext).To4() != nil {
// Check if the domain literal is an IP address
return "", fmt.Errorf("mail: invalid IP address in domain-literal: %q", dtext)
}