foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
5.13k stars 249 forks source link

Maximum length IDNs are not usable #554

Closed Avamander closed 10 months ago

Avamander commented 2 years ago

Describe the bug

When an IDN is maximum length allowed, it will be rejected by maddy, even if it's otherwise technically usable and allowed.

For example xn--oaoaaaoaoaoaooaoaoiuaiauiuaiauaaa-f1cadccdcmd01eddchqcbe07a.tld, this is not a real domain just reproduces the problem. It just reaches the maximum length of 63 characters allowed for a label in punycode.

Steps to reproduce

Add a maximum length IDN to local_domains

Log files

/data/maddy.conf:95: invalid source routing rule: äõäoaõoäaõaäõaoäaoaäõoaäooaoaoiuaiauäõiuüõaõäiauõaaa.tld

Environment information

foxcpp commented 1 year ago

Interesting. Looks like maddy incorrectly checks the length in bytes for U-labels (that is, UTF-8) form instead of encoding to Punycode and checking that instead.

Byte length of UTF-8 encoded string 'äõäoaõoäaõaäõaoäaoaäõoaäooaoaoiuaiauäõiuüõaõäiauõaaa' is 71.

foxcpp commented 1 year ago

Pushed e6518a0 to fix this.