rushmorem / publicsuffix

An implementation of Mozilla's Public Suffix List in Rust
MIT License
96 stars 17 forks source link

Fix panic in Domain::assemble caused by having a single label with trailing dot #9

Closed jonasbb closed 7 years ago

jonasbb commented 7 years ago

Domain::find_match miscounts the labels as being 2, if there is a single label with a trailing dot causing an index out of range panic.

Fixes https://github.com/rushmorem/publicsuffix/issues/8

I just double checked that it still errors for double trailing dots. For everything parsed with parse_domain the check in line 668 catches it. For parse_dns_name the to_ascii method errors with a TooShortForDns.

It might make sense to replace the ? with a chain_err and also convert it into InvalidDomain, but thats a different issue.

rushmorem commented 7 years ago

Looks good. Thank you :)

rushmorem commented 7 years ago

It might make sense to replace the ? with a chain_err and also convert it into InvalidDomain, but thats a different issue.

It does. Would you like to tackle this as well?