changeset 1622:45fb262230c9 draft

Allocate space for null terminator.
author Rob Landley <rob@landley.net>
date Mon, 22 Dec 2014 17:04:47 -0600
parents 53bfe8ac762b
children f67b1e9e91b4
files lib/lib.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Mon Dec 22 13:45:35 2014 -0600
+++ b/lib/lib.c	Mon Dec 22 17:04:47 2014 -0600
@@ -512,8 +512,7 @@
   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;