]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ext_ldap_group_acl: avoid infinite loop on login containing '%s' (#2217)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Tue, 9 Sep 2025 05:29:34 +0000 (05:29 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 9 Sep 2025 05:29:44 +0000 (05:29 +0000)
src/acl/external/LDAP_group/ext_ldap_group_acl.cc

index 997bd7aa6a3b64328c343ebce9863c20d1e6dfe0..69ba3e3ebac4c9972a4d34109f081c31b2bac729 100644 (file)
@@ -747,10 +747,10 @@ searchLDAPGroup(LDAP * ld, const char *group, const char *member, const char *ex
 static void
 formatWithString(std::string &formatted, const std::string &value)
 {
-    size_t start_pos = 0;
+    std::string::size_type start_pos = 0;
     while ((start_pos = formatted.find("%s", start_pos)) != std::string::npos) {
         formatted.replace(start_pos, 2, value);
-        start_pos += 2;
+        start_pos += value.length();
     }
 }