The fix is in upstream git tree as commit:
commit 72ff7dfe7222fddf784bc866bfe7f1ec226e407d
Author: Mikko Rapeli <[email protected]>
Date: Wed Sep 26 16:12:30 2012 +0200
Fix string null termination and SIGABRT from glibc
According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
the string is not null terminated when too much data is read.
This patch fixes the crashes on my system.
diff --git a/src/process/process.cpp b/src/process/process.cpp
index 71f81b6..34dc68d 100644
--- a/src/process/process.cpp
+++ b/src/process/process.cpp
@@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
process::process(const char *_comm, int _pid, int _tid) : power_consumer()
{
- char line[4096];
+ char line[4097];
ifstream file;
strcpy(comm, _comm);
@@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) :
power_consumer()
file.open(line);
while (file) {
file.getline(line, 4096);
+ line[4096] = '\0';
if (strstr(line, "Tgid")) {
char *c;
c = strchr(line, ':');
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]