]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] checks: ensure that we can inherit binary checks from the defaults section
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Oct 2010 14:15:31 +0000 (16:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Oct 2010 17:04:35 +0000 (19:04 +0200)
Health checks were all pure ASCII, but we're going to have to support some
binary checks (eg: SQL). When they're inherited from the default section,
they will be truncated to the first \0 due to strdup(). Let's fix that with
a simple malloc.
(cherry picked from commit 98fc04a766bcff80f57db2b1cd865c91761b131b)

src/cfgparse.c

index 25e78ad7a00f0539c59570b1673913eaa82871a0..617bb4113f46772a464500aaa764214d4a5f113c 100644 (file)
@@ -1169,8 +1169,10 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        curproxy->fullconn = defproxy.fullconn;
                        curproxy->conn_retries = defproxy.conn_retries;
 
-                       if (defproxy.check_req)
-                               curproxy->check_req = strdup(defproxy.check_req);
+                       if (defproxy.check_req) {
+                               curproxy->check_req = calloc(1, defproxy.check_len);
+                               memcpy(curproxy->check_req, defproxy.check_req, defproxy.check_len);
+                       }
                        curproxy->check_len = defproxy.check_len;
 
                        if (defproxy.cookie_name)