]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
fixes segfault in iptables-save
authorHarald Welte <laforge@gnumonks.org>
Tue, 23 Jan 2001 22:46:22 +0000 (22:46 +0000)
committerHarald Welte <laforge@gnumonks.org>
Tue, 23 Jan 2001 22:46:22 +0000 (22:46 +0000)
iptables-save.c

index 2e716e1e50f52c8119a9193fa3dd6903c9b45a77..8795cb1771c01eb4212bc3c1b44f880d174f09a9 100644 (file)
@@ -100,14 +100,15 @@ static int non_zero(const void *ptr, size_t size)
 }
 #endif
 
-static int print_match(const struct ipt_entry_match *e)
+static int print_match(const struct ipt_entry_match *e,
+                       const struct ipt_ip *ip)
 {
        struct iptables_match *match
                = find_match(e->u.user.name, TRY_LOAD);
 
        if (match) {
                printf("-m %s ", e->u.user.name);
-               match->save(NULL, e);
+               match->save(ip, e);
        } else {
                if (e->u.match_size) {
                        fprintf(stderr,
@@ -168,7 +169,7 @@ static void print_rule(const struct ipt_entry *e,
 
        /* Print matchinfo part */
        if (e->target_offset) {
-               IPT_MATCH_ITERATE(e, print_match);
+               IPT_MATCH_ITERATE(e, print_match, &e->ip);
        }
 
        /* Print target name */ 
@@ -181,7 +182,7 @@ static void print_rule(const struct ipt_entry *e,
                        = find_target(t->u.user.name, TRY_LOAD);
 
                if (target)
-                       target->save(NULL, t);
+                       target->save(&e->ip, t);
                else {
                        /* If some bits are non-zero, it implies we *need*
                           to understand it */