Skip to contentSkip to conversation

xtables crashed

DISCUSSION basteon 2 participants 2 messages Nov 14, 2009 – Nov 15, 2009 netfilter

lore
Share & tools
lore

basteon

author
#0 lore raw

hello every1,
why if I tried to use this code, I've got segfault everytime? int main(void){
printf("AFTER\n");
xtables_error(PARAMETER_PROBLEM, "unexpected ! flag"); printf("BEFORE\n");
exit(1);
}
my compilation flags...
gcc -Wall -ggdb -o table -I/usr/iptables-1.4.4/include/ -L/usr/iptables-1.4.4/lib/ -liptc -lxtables iptest.c
and trace...
AFTER
==23806== Invalid read of size 4
==23806== at 0x80484E6: main (iptest.c:23)
==23806== Address 0x14 is not stack'd, malloc'd or (recently) free'd ==23806==
==23806== Process terminating with default action of signal 11 (SIGSEGV) ==23806== Access not within mapped region at address 0x14
==23806== at 0x80484E6: main (iptest.c:23)
--23806-- REDIR: 0x40c4790 (free) redirected to 0x4022ad0 (free) ==23806==
==23806== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19 from 1) ==23806==
==23806== 1 errors in context 1 of 1:
==23806== Invalid read of size 4
==23806== at 0x80484E6: main (iptest.c:23)
==23806== Address 0x14 is not stack'd, malloc'd or (recently) free'd --23806--
--23806-- supp: 19 dl-hack3-cond-1
==23806==
==23806== IN SUMMARY: 1 errors from 1 contexts (suppressed: 19 from 1)

#1 lore raw
Quoted 8 lines · basteon

hello every1,
why if I tried to use this code, I've got segfault everytime? int main(void){
printf("AFTER\n");
xtables_error(PARAMETER_PROBLEM, "unexpected ! flag"); printf("BEFORE\n");
exit(1);
}

You are not allowed to just call xtables_error without the initialization that iptables.c etc. do.