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

List:       busybox
Subject:    [BusyBox] bug#1302: busybox 0.60.5 which segfaults when PATH not set
From:       Michael Smith <msmith () cbnco ! com>
Date:       2003-02-18 13:36:03
[Download RAW message or body]

Package: busybox
Version: 0.60.5
Severity: normal

`which' in busybox 0.60.5 segfaults if getenv("PATH") fails. This patch
fixes it. (I'm just pasting it in here because it's small, so tabs/spaces
are probably messed.)

--- which.c     17 Sep 2002 14:56:45 -0000      1.1.1.1
+++ which.c     18 Feb 2003 19:29:38 -0000      1.2
@@ -39,7 +39,8 @@

        path_list = getenv("PATH");
        if (!path_list)
-               path_list = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin";
+               path_list = strdup("/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin");
+       else path_list = strdup(path_list);

        /* Replace colons with zeros in path_parsed and count them */
        for(i=strlen(path_list); i > 0; i--)
@@ -68,6 +69,7 @@
                if (!found)
                        status = EXIT_FAILURE;
        }
+       free(path_list);
        return status;
 }


Thanks,
Mike



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

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