From: Vsevolod Stakhov Date: Mon, 26 Jul 2021 17:58:22 +0000 (+0100) Subject: [Minor] Do not advance iterator X-Git-Tag: 3.0~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12210cb99c1a508c822936ac7d8e7ddeea8590e3;p=rspamd.git [Minor] Do not advance iterator --- diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 97a8640c5..1d8206bba 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -574,21 +574,17 @@ html_is_absolute_url(std::string_view st) -> bool [](auto c) {return !g_ascii_isalnum(c);}); if (alnum_pos != std::end(st)) { - std::advance(alnum_pos, 1); + if (*alnum_pos == ':') { + if (st.substr(0, std::distance(std::begin(st), alnum_pos)) == "mailto") { + return true; + } - if (alnum_pos != std::end(st)) { - if (*alnum_pos == ':') { - if (st.substr(0, std::distance(std::begin(st), alnum_pos)) == "mailto") { + std::advance(alnum_pos, 1); + if (alnum_pos != std::end(st)) { + /* Include even malformed urls */ + if (*alnum_pos == '/' || *alnum_pos == '\\') { return true; } - - std::advance(alnum_pos, 1); - if (alnum_pos != std::end(st)) { - /* Include even malformed urls */ - if (*alnum_pos == '/' || *alnum_pos == '\\') { - return true; - } - } } } }