[Scummvm-cvs-logs] SF.net SVN: scummvm:[49916] scummvm/trunk/common/translation.cpp

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Thu Jun 17 05:22:52 CEST 2010


Revision: 49916
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49916&view=rev
Author:   tdhs
Date:     2010-06-17 03:22:52 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
Correction for Invalid reads in Translation iconv calls reported by Valgrind.

The string terminators were omitted from the iconv call and not restored.

Modified Paths:
--------------
    scummvm/trunk/common/translation.cpp

Modified: scummvm/trunk/common/translation.cpp
===================================================================
--- scummvm/trunk/common/translation.cpp	2010-06-17 01:10:26 UTC (rev 49915)
+++ scummvm/trunk/common/translation.cpp	2010-06-17 03:22:52 UTC (rev 49916)
@@ -128,11 +128,11 @@
 #ifdef USE_TERMCONV
 bool TranslationManager::convert(const char *message) {
 	// Preparing conversion origin
-	size_t len = strlen(message);
+	size_t len = strlen(message) + 1;
 #ifdef ICONV_USES_CONST
 	const char **pmsg = &message;
 #else
-	char *msgcpy = new char[len + 1];
+	char *msgcpy = new char[len];
 	strcpy(msgcpy, message);
 	char *msg = msgcpy;
 	char **pmsg = &msg;
@@ -158,7 +158,7 @@
 
 const char *TranslationManager::convertTerm(const char *message) {
 #ifdef USE_TERMCONV
-	size_t len = strlen(message);
+	size_t len = strlen(message) + 1;
 	if (!_convmsg) {
 		_sizeconv = len * 2;
 		_convmsg = new char[_sizeconv];


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list