Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162090055
D37422.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37422.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D37422: tftp: Fix buffer overflow and fd leak in multi-file PUT.
Attached
Detach File
Event Timeline
Log In to Comment