Page MenuHomeFreeBSD

D37422.diff
No OneTemporary

D37422.diff

diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -445,7 +445,7 @@
{
int fd;
int n;
- char *cp, *targ;
+ char *cp, *targ, *path;
char line[MAXLINE];
struct stat sb;
@@ -507,26 +507,32 @@
}
/* this assumes the target is a directory */
/* on a remote unix system. hmmmm. */
- cp = strchr(targ, '\0');
- *cp++ = '/';
for (n = 1; n < argc - 1; n++) {
- strcpy(cp, tail(argv[n]));
+ if (asprintf(&path, "%s/%s", targ, tail(argv[n])) < 0)
+ err(1, "malloc");
+
fd = open(argv[n], O_RDONLY);
if (fd < 0) {
warn("%s", argv[n]);
+ free(path);
continue;
}
if (fstat(fd, &sb) < 0) {
warn("%s", argv[n]);
+ close(fd);
+ free(path);
continue;
}
asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size);
if (verbose)
printf("putting %s to %s:%s [%s]\n",
- argv[n], hostname, targ, mode);
- xmitfile(peer, port, fd, targ, mode);
+ argv[n], hostname, path, mode);
+ xmitfile(peer, port, fd, path, mode);
+ close(fd);
+
+ free(path);
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 10, 3:51 PM (4 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34933733
Default Alt Text
D37422.diff (1 KB)

Event Timeline