From 2c9bc7ed8df5365c8e48d59efa5053efa0fbaa64 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 17 Apr 2017 12:17:17 +0200 Subject: [PATCH] winansi: avoid use of uninitialized value When stdout is not connected to a Win32 console, we incorrectly used an uninitialized value for the "plain" character attributes. Detected by Coverity. Signed-off-by: Johannes Schindelin --- compat/winansi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/winansi.c b/compat/winansi.c index 7e3534e9a1..8c87b0f552 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -100,6 +100,8 @@ static int is_console(int fd) if (!fd) { if (!GetConsoleMode(hcon, &mode)) return 0; + sbi.wAttributes = FOREGROUND_BLUE | FOREGROUND_GREEN | + FOREGROUND_RED; } else if (!GetConsoleScreenBufferInfo(hcon, &sbi)) return 0;