From f685dc8a297618b76d81a192a28f7d586e9a170f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 20 Nov 2014 01:41:23 -0600 Subject: Fix improperly sized string buffers in compton pid code --- twin/workspace.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'twin/workspace.cpp') diff --git a/twin/workspace.cpp b/twin/workspace.cpp index b6b1e2f62..14ab22efb 100644 --- a/twin/workspace.cpp +++ b/twin/workspace.cpp @@ -241,7 +241,7 @@ Workspace::Workspace( bool restore ) char uidstr[sizeof(uid_t)*8+1]; sprintf(uidstr, "%d", getuid()); int n = strlen(P_tmpdir)+strlen(uidstr)+strlen(pidfile)+3; - filename = (char*)malloc(n*sizeof(char)); + filename = (char*)malloc(n*sizeof(char)+1); memset(filename,0,n); strcat(filename, P_tmpdir); strcat(filename, "/."); @@ -1090,7 +1090,7 @@ void Workspace::slotReconfigure() char uidstr[sizeof(uid_t)*8+1]; sprintf(uidstr, "%d", getuid()); int n = strlen(P_tmpdir)+strlen(uidstr)+strlen(pidfile)+3; - filename = (char*)malloc(n*sizeof(char)); + filename = (char*)malloc(n*sizeof(char)+1); memset(filename,0,n); strcat(filename, P_tmpdir); strcat(filename, "/."); -- cgit v1.2.1