changeset 4054:44a43a2654b3

6544696 rm dumps core for argument ""
author sn199410
date Tue, 17 Apr 2007 09:58:17 -0700
parents 4d5790f56f2a
children 9b8dd5af941d
files usr/src/cmd/rm/rm.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/rm/rm.c	Tue Apr 17 07:41:33 2007 -0700
+++ b/usr/src/cmd/rm/rm.c	Tue Apr 17 09:58:17 2007 -0700
@@ -84,7 +84,7 @@
 static boolean_t silent, interactive, recursive, ontty;
 
 static char *pathbuf;
-static size_t pathbuflen;
+static size_t pathbuflen = MAXPATHLEN;
 
 static int maxfds = MAXINT;
 static int nfds;
@@ -157,6 +157,10 @@
 		exit(2);
 	}
 
+	pathbuf = malloc(pathbuflen);
+	if (pathbuf == NULL)
+		memerror();
+
 	for (; *argv != NULL; argv++) {
 		char *p = strrchr(*argv, '/');
 		if (p == NULL)