]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: vars: Fix bogus free() during deinit() for http-request rules
authorTim Duesterhus <tim@bastelstu.be>
Sun, 14 Jun 2020 15:27:36 +0000 (17:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Jun 2020 16:51:11 +0000 (18:51 +0200)
commit01a0ce39e28e1056d4dd513a9ef8734c5545c184
tree9c1361722c39e39b5519a7e5b5e2c54a0780d694
parentf3ca5a0273e73a7b213eb09cb3dc5856648b86c3
BUG/MAJOR: vars: Fix bogus free() during deinit() for http-request rules

We cannot simply `release_sample_expr(rule->arg.vars.expr)` for a
`struct act_rule`, because `rule->arg` is a union that might not
contain valid `vars`. This leads to a crash on a configuration using
`http-request redirect` and possibly others:

    frontend http
     mode http
     bind 127.0.0.1:80
     http-request redirect scheme https

Instead a `struct act_rule` has a `release_ptr` that must be used
to properly free any additional storage allocated.

This patch fixes a regression in commit ff78fcdd7f15c8626c7e70add7a935221ee2920c.
It must be backported to whereever that patch is backported.

It has be verified that the configuration above no longer crashes.
It has also been verified that the configuration in ff78fcdd7f15c8626c7e70add7a935221ee2920c
does not leak.
src/haproxy.c
src/vars.c