]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: applet: Fix applet_getword() to not return one extra byte
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Jul 2025 16:23:57 +0000 (18:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Jul 2025 07:16:56 +0000 (09:16 +0200)
applet_getword() function is returning one extra byte when a string is
returned because the "ret" variable is not reset before the loop on the
data. The patch also fixes applet_getline().

It is a 3.3-specific issue. No need to backport.

include/haproxy/applet.h

index 261adfa1dc5362a177b6ef95cbc6a7c53eaf64d0..6eec621b4f38572a206ffed0d6327f86861d6a14 100644 (file)
@@ -645,7 +645,7 @@ static inline int applet_getword(const struct appctx *appctx, char *str, int len
        }
 
        p = b_head(buf);
-
+       ret = 0;
        while (max) {
                *str++ = *p;
                ret++;