]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: pools: reject creation of pools containing invalid chars in their name
authorWilly Tarreau <w@1wt.eu>
Mon, 8 Jun 2026 06:54:37 +0000 (08:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 8 Jun 2026 06:54:37 +0000 (08:54 +0200)
In order to preventively avoid issues that complicate debugging, let's
report to developers early if a pool name is not acceptable. This patch
does it in create_pool_from_reg() which catches both direct and declared
registrations. Aside the previous case, this didn't catch any other
occurrence.

src/pool.c

index 391c755b7cbf9829f391b4b142ce5a5a1b66bf6a..8e7937191f758027d41a76878410dd53fb41ef69 100644 (file)
@@ -370,6 +370,13 @@ struct pool_head *create_pool_from_reg(const char *name, struct pool_registratio
                return NULL;
        }
 
+       if (invalid_char(name)) {
+               ha_alert("Pool '%s' declared at %s:%u contains invalid chars in its name and "
+                        "cannot be registered. Please report to developers. Aborting.\n",
+                        name, reg->file, reg->line);
+               return NULL;
+       }
+
        extra_mark = (pool_debugging & POOL_DBG_TAG) ? POOL_EXTRA_MARK : 0;
        extra_caller = (pool_debugging & POOL_DBG_CALLER) ? POOL_EXTRA_CALLER : 0;
        extra = extra_mark + extra_caller;