[Scummvm-cvs-logs] scummvm master -> 62b98913de165f6fd8663877911fe765fff9a852

Strangerke Strangerke at scummvm.org
Mon Sep 29 00:50:22 CEST 2014


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

Summary:
62b98913de MADS: Rex - Avoid potential not null terminated buffers after the use of strncpy


Commit: 62b98913de165f6fd8663877911fe765fff9a852
    https://github.com/scummvm/scummvm/commit/62b98913de165f6fd8663877911fe765fff9a852
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-09-29T00:48:07+02:00

Commit Message:
MADS: Rex - Avoid potential not null terminated buffers after the use of strncpy

Changed paths:
    engines/mads/nebular/menu_nebular.cpp



diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp
index d76eb12..4f9493a 100644
--- a/engines/mads/nebular/menu_nebular.cpp
+++ b/engines/mads/nebular/menu_nebular.cpp
@@ -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;
 }
 
@@ -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, '[');
 			}
@@ -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;
 }
 






More information about the Scummvm-git-logs mailing list