[Powertop] [PATCH] prevent jump on uninitialized value

Sergey Senozhatsky <sergey.senozhatsky at gmail.com> Wed, 27 Jun 2012 11:17:14 +0300
Newsgroups dev.linux.lists.powertop
Message-ID <[email protected]>
workload is getting 'initialized' with stack garbage,
so later conditional check of !workload[0] in report()
is invalid.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.cpp b/src/main.cpp
index d8e2a47..7a1b976 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -356,7 +356,7 @@ int main(int argc, char **argv)
 	int c;
 	bool wantreport = FALSE;
 	char filename[4096];
-	char workload[4096];
+	char workload[4096] = {0,};
 	int  iterations = 1;
 
 #ifndef DISABLE_TRYCATCH