[PATCH] nameif: fix invalid pointer and double-free cleanup problems
Thomas De Schampheleire
patrickdepinguin+busybox at gmail.com
Wed Feb 20 18:43:11 UTC 2013
The cleanup code at the end of nameif would free the ch pointer, and
then dereference it to obtain ch->next. This causes glibc to detect
either 'invalid pointer' or 'double-free or corruption' problems.
The problem arises for example when using nameif with an /etc/mactab
file containing two entries: one with an existing MAC-address and one
with a non-existing MAC address.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
diff --git a/networking/nameif.c b/networking/nameif.c
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -315,8 +315,11 @@ int nameif_main(int argc UNUSED_PARAM, c
delete_eth_table(ch);
}
if (ENABLE_FEATURE_CLEAN_UP) {
- for (ch = clist; ch; ch = ch->next)
+ ethtable_t *next = NULL;
+ for (ch = clist; ch; ch = next) {
+ next = ch->next;
delete_eth_table(ch);
+ }
config_close(parser);
};
More information about the busybox
mailing list