From 9b5000c920f2ba44dea1ef45f3a23191d46489b8 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 22 Dec 2014 17:04:47 -0600 Subject: [PATCH] Allocate space for null terminator. --- lib/lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lib.c b/lib/lib.c index 490235f..ade0786 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; -- 2.7.4