Date: Thu, 23 Jan 1997 21:20:09 -0700 From: Warner Losh <imp@village.org> To: andreas@klemm.gtn.com (Andreas Klemm), current@freebsd.org Subject: Re: restore dies with: canonname: not enough bufferspace Message-ID: <E0vnd7Z-0000g7-00@rover.village.org> In-Reply-To: Your message of "Thu, 23 Jan 1997 23:36:27 %2B0100." <1899.854058987@critter.dk.tfs.com> References: <1899.854058987@critter.dk.tfs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <1899.854058987@critter.dk.tfs.com> Poul-Henning Kamp writes: : There is a patch in a PR for this one, please try it out. The PR number is 2536. The patch looks to be correct. I didn't catch the sizeof(char *) when I reviewed it. Pass the conical hat :-). A local copy here seems to have worked well for me. If no one objects, I'll commit this tomorrow afternoon. There is another, identical PR 2446, but that one lacks the patch :-). Warner P.S. Here's the patch, applied by hand here, that seems to have fixed it for me. This patch is from the above PR by Flemming Jacobsen <fj@tfs.com> with one minor stylistic nit corrected. Index: interactive.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sbin/restore/interactive.c,v retrieving revision 1.2 diff -u -r1.2 interactive.c --- interactive.c 1997/01/01 14:08:45 1.2 +++ interactive.c 1997/01/24 04:13:14 @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0vnd7Z-0000g7-00>