projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oops. Forgot these....
[oweals/busybox.git]
/
coreutils
/
uudecode.c
diff --git
a/coreutils/uudecode.c
b/coreutils/uudecode.c
index c0e8cea8cb5ed571baaac30c1bbbf68c9ea3d1a7..a4059ddfe9b78c34221a902fe9d68994a0dfceb2 100644
(file)
--- a/
coreutils/uudecode.c
+++ b/
coreutils/uudecode.c
@@
-22,13
+22,13
@@
*/
*/
-#include "busybox.h"
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
+#include "busybox.h"
#include "pwd_grp/pwd.h"
#include "pwd_grp/grp.h"
#include "pwd_grp/pwd.h"
#include "pwd_grp/grp.h"
@@
-201,12
+201,13
@@
static int decode (const char *inname,
const char *forced_outname)
{
struct passwd *pw;
const char *forced_outname)
{
struct passwd *pw;
- register int n;
register char *p;
register char *p;
- int mode
, n1
;
+ int mode;
char buf[2 * BUFSIZ];
char *outname;
int do_base64 = 0;
char buf[2 * BUFSIZ];
char *outname;
int do_base64 = 0;
+ int res;
+ int dofre;
/* Search for header line. */
/* Search for header line. */
@@
-226,6
+227,7
@@
static int decode (const char *inname,
}
/* If the output file name is given on the command line this rules. */
}
/* If the output file name is given on the command line this rules. */
+ dofre = FALSE;
if (forced_outname != NULL)
outname = (char *) forced_outname;
else {
if (forced_outname != NULL)
outname = (char *) forced_outname;
else {
@@
-246,12
+248,8
@@
static int decode (const char *inname,
error_msg("%s: No user `%s'", inname, buf + 1);
return FALSE;
}
error_msg("%s: No user `%s'", inname, buf + 1);
return FALSE;
}
- n = strlen (pw->pw_dir);
- n1 = strlen (p);
- outname = (char *) alloca ((size_t) (n + n1 + 2));
- memcpy (outname + n + 1, p, (size_t) (n1 + 1));
- memcpy (outname, pw->pw_dir, (size_t) n);
- outname[n] = '/';
+ outname = concat_path_file(pw->pw_dir, p);
+ dofre = TRUE;
}
}
}
}
@@
-261,6
+259,8
@@
static int decode (const char *inname,
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
perror_msg("%s", outname); /* */
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
perror_msg("%s", outname); /* */
+ if (dofre)
+ free(outname);
return FALSE;
}
return FALSE;
}
@@
-269,9
+269,12
@@
static int decode (const char *inname,
/* For each input line: */
if (do_base64)
/* For each input line: */
if (do_base64)
-
return
read_base64 (inname);
+
res =
read_base64 (inname);
else
else
- return read_stduu (inname);
+ res = read_stduu (inname);
+ if (dofre)
+ free(outname);
+ return res;
}
int uudecode_main (int argc,
}
int uudecode_main (int argc,