[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] [PATCH] add assert to detect infinite loop in findvar()
From:       Dan Kegel <dank () kegel ! com>
Date:       2002-12-19 18:21:04
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic