]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: do not emit orig_opts twice
authorJan Engelhardt <jengelh@medozas.de>
Sun, 28 Nov 2010 14:42:00 +0000 (15:42 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 28 Nov 2010 14:42:00 +0000 (15:42 +0100)
This just happened to cross my eye; there was no error, but fixing
this up saves a pitfall, and some memory.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
xtables.c

index d0aa868876831b62ac61f7edb88c56fec1c51fbb..2137c98b5ad885c8e268801d84acfaf081259bbd 100644 (file)
--- a/xtables.c
+++ b/xtables.c
@@ -103,6 +103,10 @@ struct option *xtables_merge_options(struct option *orig_opts,
        memcpy(merge, orig_opts, sizeof(*mp) * num_oold);
        mp = merge + num_oold;
 
+       /* Since @opts also has @orig_opts already, skip the entries */
+       oldopts += num_oold;
+       num_old -= num_oold;
+
        /* Second, the new options */
        xt_params->option_offset += 256;
        *option_offset = xt_params->option_offset;