Skip to content

Commit

Permalink
curses ui: always initialize all curses_line fields
Browse files Browse the repository at this point in the history
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 <samuel.thibault@ens-lyon.org>
Message-Id: <20190315130932.26094-1-samuel.thibault@ens-lyon.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
sthibaul authored and kraxel committed Mar 18, 2019
1 parent 18e845f commit a5489ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a5489ae

Please sign in to comment.