[BusyBox] [PATCH] add assert to detect infinite loop in findvar()
Dan Kegel
dank at kegel.com
Thu Dec 19 18:21:04 UTC 2002
I just upgraded from busybox 0.60.2 to 0.60.5 to get
the zcat fix, and sadly, I ran smack-dab into another
problem: the command
sh foo.sh
now hangs, while
/bin/sh foo.sh
works.
A little spelunking with gdb, and I discovered ash.c's findvar()
was in an infinite loop. Here's a patch that adds an assertion
to catch this:
--- busybox-0.60.5/ash.c.orig Thu Dec 19 17:12:01 2002
+++ busybox-0.60.5/ash.c Thu Dec 19 17:11:32 2002
@@ -12154,6 +12154,7 @@
static struct var **findvar(struct var **vpp, const char *name)
{
for (; *vpp; vpp = &(*vpp)->next) {
+ assert(vpp != &(*vpp)->next);
if (varequal((*vpp)->text, name)) {
break;
}
Can somebody who knows the code have a look at this?
Thanks,
Dan
More information about the busybox
mailing list