From a5489ae5bbd270f2a72b2179a9adf4089e3fb7b8 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 15 Mar 2019 14:09:32 +0100 Subject: [PATCH] curses ui: always initialize all curses_line fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cchar_t can contain not only attr and chars fields, but also ext_color. Initialize the whole structure to zero instead of enumerating fields. Spotted by Coverity: CID 1399711 Signed-off-by: Samuel Thibault Message-Id: <20190315130932.26094-1-samuel.thibault@ens-lyon.org> Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Gerd Hoffmann --- ui/curses.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/curses.c b/ui/curses.c index 3a7e8649f3..4ef9b9c677 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -75,9 +75,9 @@ static void curses_update(DisplayChangeListener *dcl, if (vga_to_curses[ch].chars[0]) { curses_line[x] = vga_to_curses[ch]; } else { - curses_line[x].chars[0] = ch; - curses_line[x].chars[1] = 0; - curses_line[x].attr = 0; + curses_line[x] = (cchar_t) { + .chars[0] = ch, + }; } curses_line[x].attr |= at; }