Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 1997 17:33:45 +0100 (MET)
From:      fj@tfs.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2536: restore dies in interactive mode
Message-ID:  <199701201633.RAA28438@schizo.dk.tfs.com>
Resent-Message-ID: <199701201640.IAA10693@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2536
>Category:       bin
>Synopsis:       restore dies in interactive mode
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 20 08:40:01 PST 1997
>Last-Modified:
>Originator:     Flemming Jacobsen
>Organization:
>Release:        FreeBSD 2.2-RELEASE i386
>Environment:

	FreeBSD 2.2, as built by PHK 970114.

>Description:

	In interactive mode. Whenever ls {directory} or cd {directory}
	is excecuted restore aborts with:
	  canonname: not enough bufferspace.

>How-To-Repeat:

	see above.

>Fix:
	
Index: interactive.c
===================================================================
RCS file: /home/ncvs/src/sbin/restore/interactive.c,v
retrieving revision 1.1.1.1.8.1
diff -u -r1.1.1.1.8.1 interactive.c
--- interactive.c	1997/01/12 22:02:44	1.1.1.1.8.1
+++ interactive.c	1997/01/20 16:20:32
@@ -82,7 +82,7 @@
 static char	*copynext __P((char *, char *));
 static int	 fcmp __P((const void *, const void *));
 static void	 formatf __P((struct afile *, int));
-static void	 getcmd __P((char *, char *, char *, struct arglist *));
+static void	 getcmd __P((char *, char *, char *, int, struct arglist *));
 struct dirent	*glob_readdir __P((RST_DIR *dirp));
 static int	 glob_stat __P((const char *, struct stat *));
 static void	 mkentry __P((struct direct *, struct afile *));
@@ -121,7 +121,7 @@
 		volno = 0;
 	}
 	runshell = 1;
-	getcmd(curdir, cmd, name, &arglist);
+	getcmd(curdir, cmd, name,sizeof(name), &arglist);
 	switch (cmd[0]) {
 	/*
 	 * Add elements to the extraction list.
@@ -300,9 +300,10 @@
  * eliminate any embedded ".." components.
  */
 static void
-getcmd(curdir, cmd, name, ap)
+getcmd(curdir, cmd, name, size, ap)
 	char *curdir, *cmd, *name;
 	struct arglist *ap;
+	int size;
 {
 	register char *cp;
 	static char input[BUFSIZ];
@@ -357,7 +358,7 @@
 	 * If it is an absolute pathname, canonicalize it and return it.
 	 */
 	if (rawname[0] == '/') {
-		canon(rawname, name, sizeof(name));
+		canon(rawname, name, size);
 	} else {
 		/*
 		 * For relative pathnames, prepend the current directory to
@@ -366,7 +367,7 @@
 		(void) strcpy(output, curdir);
 		(void) strcat(output, "/");
 		(void) strcat(output, rawname);
-		canon(output, name, sizeof(name));
+		canon(output, name, size);
 	}
 	if (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob) < 0)
 		fprintf(stderr, "%s: out of memory\n", ap->cmd);
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701201633.RAA28438>