summaryrefslogtreecommitdiffstats
path: root/twin
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-20 01:41:23 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-20 01:41:23 -0600
commitf685dc8a297618b76d81a192a28f7d586e9a170f (patch)
treeea7a5b1374427732d23c4210bc753e41c7d621ac /twin
parentf568aef38d36b6429232c1dfe94ab9da802abfe1 (diff)
downloadtdebase-f685dc8a297618b76d81a192a28f7d586e9a170f.tar.gz
tdebase-f685dc8a297618b76d81a192a28f7d586e9a170f.zip
Fix improperly sized string buffers in compton pid code
Diffstat (limited to 'twin')
-rw-r--r--twin/compton-tde/compton.c4
-rw-r--r--twin/workspace.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c
index 3f9b65e69..36af91f5b 100644
--- a/twin/compton-tde/compton.c
+++ b/twin/compton-tde/compton.c
@@ -110,7 +110,7 @@ void write_pid_file(pid_t pid)
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, "/.");
@@ -141,7 +141,7 @@ void delete_pid_file()
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, "/.");
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, "/.");