From 4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sun, 10 May 2009 18:43:17 +1000 Subject: get_wincon_width_height(): do not return uninitialized value if GetConsoleScreenBufferInfo() fails --- libbb/termios.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libbb/termios.c b/libbb/termios.c index 5695e9ba2..c05bb6dbb 100644 --- a/libbb/termios.c +++ b/libbb/termios.c @@ -226,11 +226,9 @@ static int get_wincon_width_height(const int fd, int *width, int *height) CONSOLE_SCREEN_BUFFER_INFO sbi; console = GetStdHandle(STD_OUTPUT_HANDLE); - if (console == INVALID_HANDLE_VALUE || !console) + if (console == INVALID_HANDLE_VALUE || !console || !GetConsoleScreenBufferInfo(console, &sbi)) return -1; - GetConsoleScreenBufferInfo(console, &sbi); - if (width) *width = sbi.srWindow.Right - sbi.srWindow.Left; if (height) -- cgit v1.2.3-55-g6feb