mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
MADS: Avoid potential buffer overflows
This commit is contained in:
parent
e8cb2a37bd
commit
f24346aad7
@ -408,7 +408,7 @@ char TextView::_resourceName[100];
|
||||
|
||||
void TextView::execute(MADSEngine *vm, const Common::String &resName) {
|
||||
assert(resName.size() < 100);
|
||||
strcpy(_resourceName, resName.c_str());
|
||||
strncpy(_resourceName, resName.c_str(), sizeof(_resourceName));
|
||||
vm->_dialogs->_pendingDialog = DIALOG_TEXTVIEW;
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ void TextView::processLines() {
|
||||
processCommand();
|
||||
|
||||
// Copy rest of line (if any) to start of buffer
|
||||
strcpy(_currentLine, cEnd + 1);
|
||||
strncpy(_currentLine, cEnd + 1, sizeof(_currentLine));
|
||||
|
||||
cStart = strchr(_currentLine, '[');
|
||||
}
|
||||
@ -631,7 +631,7 @@ char AnimationView::_resourceName[100];
|
||||
|
||||
void AnimationView::execute(MADSEngine *vm, const Common::String &resName) {
|
||||
assert(resName.size() < 100);
|
||||
strcpy(_resourceName, resName.c_str());
|
||||
strncpy(_resourceName, resName.c_str(), sizeof(_resourceName));
|
||||
vm->_dialogs->_pendingDialog = DIALOG_ANIMVIEW;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user