diff options
author | Tobias Markmann <tm@ayena.de> | 2018-11-08 13:50:25 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2018-11-08 17:26:20 (GMT) |
commit | 644db9fce94670e610db46bdd28eb9d1e658a798 (patch) | |
tree | 7773b18c1eeca8d7d8cb5bb8cd25ae0b7b4a7447 /Swiften/IDN/LibIDNConverter.cpp | |
parent | 0b4e062a59613b2597b712c0106c3ed08b747637 (diff) | |
download | swift-644db9fce94670e610db46bdd28eb9d1e658a798.zip swift-644db9fce94670e610db46bdd28eb9d1e658a798.tar.bz2 |
Handle RFC 1035 label and domain len restrictions in libidn backend
LibIDNConverter was fixed to handle these restrictions
correctly.
Test-Information:
Added unit tests for RFC 1035 length restrictions for labels
and domain names.
The libidn and ICU backends pass the new test.
Change-Id: Ie570b0ee4c5c6381f7769f6178ec2a5824074221
Diffstat (limited to 'Swiften/IDN/LibIDNConverter.cpp')
-rw-r--r-- | Swiften/IDN/LibIDNConverter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Swiften/IDN/LibIDNConverter.cpp b/Swiften/IDN/LibIDNConverter.cpp index 2325015..e2a87be 100644 --- a/Swiften/IDN/LibIDNConverter.cpp +++ b/Swiften/IDN/LibIDNConverter.cpp @@ -78,6 +78,9 @@ boost::optional<std::string> LibIDNConverter::getIDNAEncoded(const std::string& if (idna_to_ascii_8z(domain.c_str(), &output, IDNA_USE_STD3_ASCII_RULES) == IDNA_SUCCESS) { std::string result(output); free(output); + if (result.size() > 255) { + return boost::optional<std::string>(); + } return result; } else { |