From f0678cfa5a4ec33feee9135fa154eaa17d14bac0 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Wed, 14 Nov 2012 19:38:05 +0000 Subject: [PATCH] Fix teh bugs, thanks div0 --- con.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/con.c b/con.c index 3e6c20d..1da837f 100644 --- a/con.c +++ b/con.c @@ -202,7 +202,7 @@ static void con_enablecolor() { #ifndef _WIN32 { - char buf[4]; + char buf[4] = {0, 0, 0, 0}; /* * This is such a hack. But I'm not linking in any libraries to @@ -217,14 +217,15 @@ static void con_enablecolor() { */ console.color_err = 0; console.color_out = 0; + + return; } /* * Handle to tput was a success, lets read in the amount of * color support. It should be at minimal 8. */ - fread(buf, sizeof(buf), 1, tput); - buf[3] = '\0'; + fread(buf, 1, sizeof(buf)-1, tput); if (atoi(buf) < 8) { console.color_err = 0; -- 2.39.2