]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: Fix test on number of fields allowed in a server-state line
authorChristopher Faulet <cfaulet@haproxy.com>
Sat, 20 Feb 2021 11:15:22 +0000 (12:15 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Sat, 20 Feb 2021 11:24:12 +0000 (12:24 +0100)
When a server-state line is parsed, a test is performed to be sure there is
enough but not too much fields. However the test is buggy. The bug was
introduced in the commit ea2cdf55e ("MEDIUM: server: Don't introduce a new
server-state file version").

No backport needed.

src/server.c

index c7ad95029016217b223db779c8ac9c55f66e17c0..732643cbc4e15a122c6bd432b7229bf76466c868 100644 (file)
@@ -3166,8 +3166,8 @@ static void srv_state_parse_line(char *buf, const int version, char **params, ch
        /* if line is incomplete line, then ignore it.
         * otherwise, update useful flags */
        if (version == 1 &&
-           arg < SRV_STATE_FILE_MIN_FIELDS_VERSION_1 &&
-           arg > SRV_STATE_FILE_MAX_FIELDS_VERSION_1)
+           (arg < SRV_STATE_FILE_MIN_FIELDS_VERSION_1 ||
+            arg > SRV_STATE_FILE_MAX_FIELDS_VERSION_1))
                params[0] = NULL;
 }