]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid upos underflowing in match loop 14404/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 2 Jul 2024 10:22:29 +0000 (12:22 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 2 Jul 2024 10:22:29 +0000 (12:22 +0200)
ext/yahttp/yahttp/router.cpp

index fdf23a45c516d861b1d9358ec02f49ab4819b08d..5f6885a887b444dc0b3ad720a292350966663719 100644 (file)
@@ -62,8 +62,15 @@ namespace YaHTTP {
           }
           nend = upos;
           params[pname] = funcptr::tie(nstart, nend);
-
-          upos--;
+          if (upos > 0) {
+            upos--;
+          }
+          else {
+            // If upos is zero, do not decrement it and then increment at bottom of loop, this disturbs Coverity.
+            // Only increment rpos and continue loop
+            rpos++;
+            continue;
+          }
         }
         else if (route[rpos] != requrl.path[upos]) {
           break;