aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2018-01-30 22:06:03 +0000
committerThierry Crozat2018-01-30 22:06:03 +0000
commit2ba8ef9dc0f023a4b3d054402fddeb11820fd878 (patch)
tree2d9556ef412069886fbf22a39abe585d4e7ee3e4
parent13324efb7f73915a56af78cae4396ecdb28f9958 (diff)
downloadscummvm-rg350-2ba8ef9dc0f023a4b3d054402fddeb11820fd878.tar.gz
scummvm-rg350-2ba8ef9dc0f023a4b3d054402fddeb11820fd878.tar.bz2
scummvm-rg350-2ba8ef9dc0f023a4b3d054402fddeb11820fd878.zip
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).
-rw-r--r--engines/supernova/state.cpp4
1 files changed, 2 insertions, 2 deletions
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) {