aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-12-22 17:04:47 -0600
committerRob Landley <rob@landley.net>2014-12-22 17:04:47 -0600
commit9b5000c920f2ba44dea1ef45f3a23191d46489b8 (patch)
tree15d489c64a098bcaf2a8dbe7e581781e8677338e /lib
parentea8be3d41f1b818081012c79c0935f9c2173924d (diff)
downloadtoybox-9b5000c920f2ba44dea1ef45f3a23191d46489b8.tar.gz
Allocate space for null terminator.
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 490235f4..ade07866 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -512,8 +512,7 @@ int copy_tempfile(int fdin, char *name, char **tempname)
struct stat statbuf;
int fd;
- *tempname = xstrndup(name, strlen(name)+6);
- strcat(*tempname,"XXXXXX");
+ *tempname = xmprintf("%s%s", name, "XXXXXX");
if(-1 == (fd = mkstemp(*tempname))) error_exit("no temp file");
if (!tempfile2zap) sigatexit(tempfile_handler);
tempfile2zap = *tempname;