bug-grep
[Top][All Lists]
Advanced

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

2.6[.1] seg fault with -r


From: Karl Berry
Subject: 2.6[.1] seg fault with -r
Date: Fri, 26 Mar 2010 16:17:31 GMT

grep 2.6 and 2.6.1, compiled from original source (on CentOS 5.4).
grep -r foo . (all args I tried did the same) gets an immediate seg fault.
Compiling with gcc 4.4.3 (though I doubt it matters), also installed
from original source.

Running under gdb shows that path is NULL upon entry to isdir1 in
lib/savedir.c.  The diff below avoids the seg fault, and I haven't found
any other bad behavior, but I'm sure it's not what you will want to
apply ...

karl


--- /usr/local/gnu/src/grep-2.6.1/lib/ORIG/savedir.c    2010-03-26 
09:11:31.000000000 -0700
+++ /usr/local/gnu/src/grep-2.6.1/lib/savedir.c 2010-03-26 09:11:13.000000000 
-0700
@@ -50,3 +50,3 @@
 
-  while (dirlen && path[dirlen - 1] == '/')
+  while (dirlen && path && path[dirlen - 1] == '/')
     dirlen--;

Diff finished at Fri Mar 26 09:13:23




reply via email to

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