[Scummvm-git-logs] scummvm master -> 2ba8ef9dc0f023a4b3d054402fddeb11820fd878

criezy criezy at scummvm.org
Tue Jan 30 23:12:26 CET 2018


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
13324efb7f SUPERNOVA: Fix out of bound access when exiting the engine while in a dialog
2ba8ef9dc0 SUPERNOVA: Ensure the GuiElement _text field is null terminated


Commit: 13324efb7f73915a56af78cae4396ecdb28f9958
    https://github.com/scummvm/scummvm/commit/13324efb7f73915a56af78cae4396ecdb28f9958
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2018-01-30T21:48:20Z

Commit Message:
SUPERNOVA: Fix out of bound access when exiting the engine while in a dialog

This was reported by coverity (CID 1385572).

Changed paths:
    engines/supernova/state.cpp


diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index f7bf70f..7e949c0 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -1422,7 +1422,7 @@ int GameManager::dialog(int num, byte rowLength[6], StringID text[6], int number
 
 	_vm->renderBox(0, 138, 320, 62, kColorBlack);
 
-	if (number && _texts[_rowsStart[_currentSentence]] != kStringDialogSeparator)
+	if (number && _currentSentence != -1 && _texts[_rowsStart[_currentSentence]] != kStringDialogSeparator)
 		_currentRoom->removeSentence(_currentSentence, number);
 
 	_guiEnabled = true;


Commit: 2ba8ef9dc0f023a4b3d054402fddeb11820fd878
    https://github.com/scummvm/scummvm/commit/2ba8ef9dc0f023a4b3d054402fddeb11820fd878
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2018-01-30T22:06:03Z

Commit Message:
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).

Changed paths:
    engines/supernova/state.cpp


diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index 7e949c0..9103a0b 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) {





More information about the Scummvm-git-logs mailing list