Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix for SEGV



Try this:

  ...) ./zsh -f
  % setopt autocd; hash wc=/bin/wc; echo|wc

It'll give you a SEGV in `isreallycom()', trying to look at
`cn->u.name' which isn't set because for hashed commands `cn->u.cmd'
is used.

Bye
 Sven

--- os/exec.c	Fri Aug 20 15:18:07 1999
+++ Src/exec.c	Tue Aug 24 14:12:19 1999
@@ -615,12 +615,16 @@
 int
 isreallycom(Cmdnam cn)
 {
-    char fullnam[MAXCMDLEN];
+    if (cn->flags & HASHED)
+	return 1;
+    else {
+	char fullnam[MAXCMDLEN];
 
-    strcpy(fullnam, cn->u.name ? *(cn->u.name) : "");
-    strcat(fullnam, "/");
-    strcat(fullnam, cn->nam);
-    return iscom(fullnam);
+	strcpy(fullnam, cn->u.name ? *(cn->u.name) : "");
+	strcat(fullnam, "/");
+	strcat(fullnam, cn->nam);
+	return iscom(fullnam);
+    }
 }
 
 /**/

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author