]> git.proxmox.com Git - mirror_iproute2.git/commit - tc/m_xt.c
fix print_ipt: segfault if more then one filter with action -j MARK.
authorAndreas Greve <andreas.greve@a-greve.de>
Sat, 10 May 2014 09:19:18 +0000 (11:19 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 13 May 2014 20:10:31 +0000 (13:10 -0700)
commit6e2e5ec28bad4561c534adf4f22b2706e385c71d
tree59fe0744ca15899515b4389eab92e762e52358dd
parent63f60e3ab3655b5d1b62d3a9f641ef7b638d2361
fix print_ipt: segfault if more then one filter with action -j MARK.

BUG: tc filter show ... produce a segmentation fault if more than one
filter rule with action -j MARK exists.

Reason: In print_ipt(...) xtables will be initialzed with a
pointer to the static struct tcipt_globals at xtables_init_all().
Later on the fields .opts and .options_offset of tcipt_globals are
modified. The call of xtables_free_opts(1) at the end of print(...)
does not restore the original values of tcipt_globals for the
modified fields. It only frees some allocated memory and sets
.opts to NULL. This leads to a segmentation fault when print_ipt()
is called for the next filter rule with action -j MARK.

Fix: Cloneing tcipt_globals on the stack as tmp_tcipt_globals and
use it instead of tcipt_globals, so tcipt_globals will be not
modified.

Signed-off-by: Andreas Greve <andreas.greve@a-greve.de>
tc/m_xt.c