Skip to content

Commit

Permalink
MADS: Rex - Avoid potential not null terminated buffers after the use…
Browse files Browse the repository at this point in the history
… of strncpy
  • Loading branch information
Strangerke committed Sep 28, 2014
1 parent 1fe9038 commit 62b9891
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions engines/mads/nebular/menu_nebular.cpp
Expand Up @@ -434,7 +434,7 @@ char TextView::_resourceName[100];

void TextView::execute(MADSEngine *vm, const Common::String &resName) {
assert(resName.size() < 100);
strncpy(_resourceName, resName.c_str(), sizeof(_resourceName));
Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName));
vm->_dialogs->_pendingDialog = DIALOG_TEXTVIEW;
}

Expand Down Expand Up @@ -496,7 +496,7 @@ void TextView::processLines() {
processCommand();

// Copy rest of line (if any) to start of buffer
strncpy(_currentLine, cEnd + 1, sizeof(_currentLine));
Common::strlcpy(_currentLine, cEnd + 1, sizeof(_currentLine));

cStart = strchr(_currentLine, '[');
}
Expand Down Expand Up @@ -788,7 +788,7 @@ char AnimationView::_resourceName[100];

void AnimationView::execute(MADSEngine *vm, const Common::String &resName) {
assert(resName.size() < 100);
strncpy(_resourceName, resName.c_str(), sizeof(_resourceName));
Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName));
vm->_dialogs->_pendingDialog = DIALOG_ANIMVIEW;
}

Expand Down

0 comments on commit 62b9891

Please sign in to comment.