diff options
author | Thierry Crozat | 2018-01-30 22:06:03 +0000 |
---|---|---|
committer | Thierry Crozat | 2018-01-30 22:06:03 +0000 |
commit | 2ba8ef9dc0f023a4b3d054402fddeb11820fd878 (patch) | |
tree | 2d9556ef412069886fbf22a39abe585d4e7ee3e4 | |
parent | 13324efb7f73915a56af78cae4396ecdb28f9958 (diff) | |
download | scummvm-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.cpp | 4 |
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) { |