xtables crashed
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)
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.