Skip to contentSkip to conversation

iptables: iptc_init segfault

DISCUSSION basteon 2 participants 2 messages Nov 15, 2009 netfilter

lore
Share & tools
lore

basteon

author
#0 lore raw

g'time of day to every1,
I tried todo iptables initailazation in my application, but untortunately received seghault, why it's happening? Which's way I can realy initialize libiptq and xtables in my program? int main(int argc, char *argv[]){
char **table;
table = &argv[2];
struct iptc_handle **handle;
printf("A %s\n",*table);
*handle = iptc_init(*table);
printf("B\n");
}

#1 lore raw
Quoted 3 lines · basteon

g'time of day to every1,
I tried todo iptables initailazation in my application, but untortunately received seghault, why it's happening?

Because your code is faulty. Had you compiled with -Wall you would have gotten

z.c:9: warning: ‘handle’ is used uninitialized in this function

Quoted 5 lines

Which's way I can realy initialize libiptq and xtables in my program? int main(int argc, char *argv[]){
char **table;
table = &argv[2];
struct iptc_handle **handle;

Quoted 9 lines

printf("A %s\n",*table);
*handle = iptc_init(*table);
printf("B\n");
}
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html