diff --git a/collects/net/dns.rkt b/collects/net/dns.rkt index 74728cce59..65fe9bdd98 100644 --- a/collects/net/dns.rkt +++ b/collects/net/dns.rkt @@ -35,12 +35,17 @@ val)]) (and matches (= (length matches) 5) + ;; check that each octet field is an octet + (andmap byte? (map string->number (cdr matches))) + ;; leading zeroes lead to query errors (not (ormap has-leading-zeroes? matches)))))) (module+ test (check-true (ip-address-string? "8.8.8.8")) - (check-true (ip-address-string? "80.8.800.8")) - (check-true (ip-address-string? "80.8.800.0")) + (check-true (ip-address-string? "12.81.255.109")) + (check-true (ip-address-string? "192.168.0.1")) + (check-false (ip-address-string? "80.8.800.8")) + (check-false (ip-address-string? "80.8.800.0")) (check-false (ip-address-string? "080.8.800.8")) (check-false (ip-address-string? "vas8.8.800.8")) (check-false (ip-address-string? "80.8.128.8dd"))