zlint
zlint copied to clipboard
Inconsistency in `IsOnionV2Address` util function
The IsOnionV2Address function comments say, "The second-to-the-right most label is a 16 character long, base32." The code actually seems to check the left-most label.
Based on similar code in IsOnionV3Address, the code in IsOnionV2Address should be updated to this:
address := labels[len(labels)-2]
if len(address) != 16 {
return false
}
_, err := onionBase32Encoding.DecodeString(address)
Originally posted by @mathewhodson in https://github.com/zmap/zlint/pull/677#discussion_r894899072