From 2ba8ef9dc0f023a4b3d054402fddeb11820fd878 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Tue, 30 Jan 2018 22:06:03 +0000 Subject: SUPERNOVA: Ensure the GuiElement _text field is null terminated This was reported by coverity (CID 1385566), and althought this was unlikely to happen, it was not impossible (due to the translations). --- engines/supernova/state.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp index 7e949c0a55..9103a0b1b2 100644 --- a/engines/supernova/state.cpp +++ b/engines/supernova/state.cpp @@ -216,11 +216,11 @@ GuiElement::GuiElement() , _textColorHighlighted(kColorLightGreen) , _textColor(kColorGreen) { - _text[0] = '\0'; + memset(_text, 0, sizeof(_text)); } void GuiElement::setText(const char *text) { - strncpy(_text, text, sizeof(_text)); + strncpy(_text, text, sizeof(_text) - 1); } void GuiElement::setTextPosition(int x, int y) { -- cgit v1.2.3