summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-02-07 15:34:33 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-02-10 13:51:59 +0100
commit289d2e5c86ffa99bc6a8c6c51f630d629afcd954 (patch)
tree338ddc1787e080a3b0da7833ee44c5b6c68c6e3a /svl/source
parent942c0d71a91839fc1762c7e93417e7bb703ea3cf (diff)
tdf#130501: Fix off-by-one error in URIHelper::resolveIdnaHost
Change-Id: Ibc231308d0fc93085933ae7d80dc8c4b2699fe02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88204 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 4c0394461af4d6bcba059161113abffbb484efe8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88295 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/misc/urihelper.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 62177ac79e25..127134d1ab72 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -742,12 +742,14 @@ OUString URIHelper::resolveIdnaHost(OUString const & url) {
if (auth.isEmpty())
return url;
sal_Int32 hostStart = auth.indexOf('@') + 1;
- sal_Int32 hostEnd = auth.getLength() - 1;
- while (hostEnd > hostStart && rtl::isAsciiDigit(auth[hostEnd])) {
+ sal_Int32 hostEnd = auth.getLength();
+ while (hostEnd > hostStart && rtl::isAsciiDigit(auth[hostEnd - 1])) {
--hostEnd;
}
- if (!(hostEnd > hostStart && auth[hostEnd] == ':')) {
- hostEnd = auth.getLength() - 1;
+ if (hostEnd > hostStart && auth[hostEnd - 1] == ':') {
+ --hostEnd;
+ } else {
+ hostEnd = auth.getLength();
}
auto asciiOnly = true;
for (auto i = hostStart; i != hostEnd; ++i) {