]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: spoe: Initialize variables used during conf parsing before any check
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 23 Mar 2018 13:37:14 +0000 (14:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Apr 2018 13:13:53 +0000 (15:13 +0200)
Some initializations must be done at the beginning of parse_spoe_flt to avoid
segmentaion fault when first errors are catched, when the "filter spoe" line is
parsed.

This patch must be backported in 1.8.
[cf: the variable "curvars" doesn't exist in 1.8. So the patch must be adapted.]

src/flt_spoe.c

index a701c70745e74413e3e56bbd612c643b9a4a57a8..9d5b3b88a5963594274aee599006d24964235009 100644 (file)
@@ -3797,6 +3797,12 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        char                        *file = NULL, *engine = NULL;
        int                          ret, pos = *cur_arg + 1;
 
+       LIST_INIT(&curmsgs);
+       LIST_INIT(&curgrps);
+       LIST_INIT(&curmphs);
+       LIST_INIT(&curgphs);
+       LIST_INIT(&curvars);
+
        conf = calloc(1, sizeof(*conf));
        if (conf == NULL) {
                memprintf(err, "%s: out of memory", args[*cur_arg]);
@@ -3845,11 +3851,6 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        curproxy  = px;
        curagent  = NULL;
        curmsg    = NULL;
-       LIST_INIT(&curmsgs);
-       LIST_INIT(&curgrps);
-       LIST_INIT(&curmphs);
-       LIST_INIT(&curgphs);
-       LIST_INIT(&curvars);
        ret = readcfgfile(file);
        curproxy = NULL;