]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: resolvers: properly initialize the sample in resolv_action_do_resolve()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 15:49:16 +0000 (17:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 15:51:58 +0000 (17:51 +0200)
The sample used to pass the IP address only had its data, px, sess and
strm fields initialized before being passed to vars_set_by_name(). It
turns out that this latter one doesn't seem to touch ctx, flags nor opt
but nothing guarantees it. Let's at least initialize the fields properly
to avoid passing random garbage.

No backport is needed.

src/resolvers.c

index f7e6fa04ec1f072db4934f4bcbb80c578c34a7a5..463576acb3305f5a3dcc1ba37c038fc9b76e1ed7 100644 (file)
@@ -3199,7 +3199,7 @@ enum act_return resolv_action_do_resolve(struct act_rule *rule, struct proxy *px
                        if (resolution->status == RSLV_STATUS_NONE)
                                goto yield;
                        if (resolution->status == RSLV_STATUS_VALID) {
-                               struct sample smp;
+                               struct sample smp = { 0 };
                                short ip_sin_family = 0;
                                void *ip = NULL;