findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] [PATCH] Avoid segfault in -execdir when PATH is unse


From: James Youngman
Subject: [Findutils-patches] [PATCH] Avoid segfault in -execdir when PATH is unset.
Date: Sun, 19 Aug 2007 16:29:45 +0100

2007-08-19  James Youngman  <address@hidden>

        find/parser.c (check_path_safety): Assume the path is safe is
        $PATH is not set.  This avoids a segfault in that situation
        and thus fixes Savannmah bug #20834.

Signed-off-by: James Youngman <address@hidden>
---
 NEWS          |    3 +++
 find/parser.c |   11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 8bda01e..1149a1c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Findutils version 4.3.9 is released under version 3 of the GNU 
General
 Public License.
 
 ** Bug Fixes
+#20834: Avoid segmentation violation for -execdir when $PATH is
+unset.  Assume that the PATH is safe in this situation.
+
 #20310: configure uses hosts's support status for "sort -z" when
 generating the updatedb script for use on the target.  This is
 inappropriate when cross-compiling, so avoid doing that.
diff --git a/find/parser.c b/find/parser.c
index a5394f2..1c14e7a 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2846,8 +2846,17 @@ make_segment (struct segment **segment,
 static void 
 check_path_safety(const char *action, char **argv)
 {
-  const char *path = getenv("PATH");
   char *s;
+  const char *path = getenv("PATH");
+  if (NULL == path)
+    {
+      /* $PATH is not set.  Assume the OS default is safe.
+       * That may not be true on Windows, but I'm not aware 
+       * of a way to get Windows to avoid searching the 
+       * current directory anyway.
+       */
+      return;
+    }
 
   (void)argv;
   
-- 
1.5.2.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]