Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115647671
D43533.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
D43533.diff
View Options
diff --git a/usr.bin/bintrans/uudecode.c b/usr.bin/bintrans/uudecode.c
--- a/usr.bin/bintrans/uudecode.c
+++ b/usr.bin/bintrans/uudecode.c
@@ -184,6 +184,7 @@
static int
decode2(void)
{
+ const char *routfile = outfile;
int flags, fd, mode;
size_t n, m;
char *p, *q;
@@ -259,28 +260,28 @@
q = p + 1;
}
if (!oflag)
- outfile = q;
+ routfile = q;
/* POSIX says "/dev/stdout" is a 'magic cookie' not a special file. */
- if (pflag || strcmp(outfile, "/dev/stdout") == 0)
+ if (pflag || strcmp(routfile, "/dev/stdout") == 0)
outfp = stdout;
else {
flags = O_WRONLY | O_CREAT | O_EXCL;
- if (lstat(outfile, &st) == 0) {
+ if (lstat(routfile, &st) == 0) {
if (iflag) {
- warnc(EEXIST, "%s: %s", infile, outfile);
+ warnc(EEXIST, "%s: %s", infile, routfile);
return (0);
}
switch (st.st_mode & S_IFMT) {
case S_IFREG:
case S_IFLNK:
/* avoid symlink attacks */
- if (unlink(outfile) == 0 || errno == ENOENT)
+ if (unlink(routfile) == 0 || errno == ENOENT)
break;
- warn("%s: unlink %s", infile, outfile);
+ warn("%s: unlink %s", infile, routfile);
return (1);
case S_IFDIR:
- warnc(EISDIR, "%s: %s", infile, outfile);
+ warnc(EISDIR, "%s: %s", infile, routfile);
return (1);
default:
if (oflag) {
@@ -288,16 +289,16 @@
flags &= ~O_EXCL;
break;
}
- warnc(EEXIST, "%s: %s", infile, outfile);
+ warnc(EEXIST, "%s: %s", infile, routfile);
return (1);
}
} else if (errno != ENOENT) {
- warn("%s: %s", infile, outfile);
+ warn("%s: %s", infile, routfile);
return (1);
}
- if ((fd = open(outfile, flags, mode)) < 0 ||
+ if ((fd = open(routfile, flags, mode)) < 0 ||
(outfp = fdopen(fd, "w")) == NULL) {
- warn("%s: %s", infile, outfile);
+ warn("%s: %s", infile, routfile);
return (1);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 12:52 PM (17 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17817823
Default Alt Text
D43533.diff (1 KB)
Attached To
Mode
D43533: bintrans: Avoid leaking a stack pointer through a global.
Attached
Detach File
Event Timeline
Log In to Comment