diff options
author | imp <imp@FreeBSD.org> | 1997-01-25 05:27:17 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-01-25 05:27:17 +0000 |
commit | 8c5715a8dbf24d9eec427b8fa2d32c843c22c18e (patch) | |
tree | bb4992bbb52968b906bd17c62f8d981fbbe5f48a /sbin/restore | |
parent | 25af4057b66b5cdee320fd581e040b735f79522d (diff) | |
download | FreeBSD-src-8c5715a8dbf24d9eec427b8fa2d32c843c22c18e.zip FreeBSD-src-8c5715a8dbf24d9eec427b8fa2d32c843c22c18e.tar.gz |
Apply patch from pr2536, after testing locally.
Fixes: PR2446 and PR2536
Submitted by: Flemming Jacobsen <fj@tfs.com>
2.2 Candidate.
Diffstat (limited to 'sbin/restore')
-rw-r--r-- | sbin/restore/interactive.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index d2158e4..9e8b9ae 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -82,7 +82,7 @@ struct arglist { 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 @@ loop: 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 @@ loop: * 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 @@ getnext: * 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 @@ getnext: (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); |