]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Do not advance iterator
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Jul 2021 17:58:22 +0000 (18:58 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Jul 2021 17:58:22 +0000 (18:58 +0100)
src/libserver/html/html.cxx

index 97a8640c52da48a60adc486d81d3df82ec4640c4..1d8206bbabc18bff47e1fce167d79d7c5837ead6 100644 (file)
@@ -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;
-                                       }
-                               }
                        }
                }
        }