diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index 8ec0e9760..cec0c870a 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -908,7 +908,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::printf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -928,7 +928,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::warnf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -948,7 +948,7 @@ ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...) char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::errorf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index d789bc1c4..0a13a9c29 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -287,7 +287,7 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const replaceStr = gBadWordFilter->getDefaultReplaceStr(); char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString, dStrlen(baseString)); + dStrcpy(ret, baseString, dStrlen(baseString) + 1); gBadWordFilter->filterString(ret, replaceStr); return ret; } diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 4071ae138..156533503 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -833,7 +833,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) continue; FrameTemp valCopy( dStrlen( val ) + 1 ); - dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); + dStrcpy( (char *)valCopy, val, valCopy.size() ); if (!pObject->writeField(itr->pFieldname, valCopy)) continue; @@ -873,7 +873,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) // continue; // FrameTemp valCopy( dStrlen( val ) + 1 ); - // dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); + // dStrcpy( (char *)valCopy, val, valCopy.size() ); // if (!pObject->writeField(itr->pFieldname, valCopy)) // continue; diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index fd5d343d2..be472f197 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -2176,8 +2176,8 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor } // Format the output path. - dStrcat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); - dStrcat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrncat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrncat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); // Are we ensuring the trailing slash? if (ensureTrailingSlash) diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index df2dd8b01..56812cd4b 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -967,10 +967,10 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi // Build the new line with the // preString + newValue + postString - dStrcat(newLine, preString, newLineLen); + dStrcat(newLine, preString, newLineLen + 1); if ( newValue ) - dStrcat(newLine, newValue, newLineLen); - dStrcat(newLine, postString, newLineLen); + dStrcat(newLine, newValue, newLineLen + 1); + dStrcat(newLine, postString, newLineLen + 1); // Clear our existing line if (mLineBuffer[lineNumber]) diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 571d1df84..bf20e8568 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2625,8 +2625,8 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , " RectI bounds = object->getSelectionGlobalBounds(); String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y ); - char* buffer = Con::getReturnBuffer( str.length() ); - dStrcpy( buffer, str.c_str(), str.length() ); + char* buffer = Con::getReturnBuffer( str.size() ); + dStrcpy( buffer, str.c_str(), str.size() ); return buffer; } diff --git a/Engine/source/platformWin32/winFileio.cpp b/Engine/source/platformWin32/winFileio.cpp index 83b7e1859..3e1974ae4 100644 --- a/Engine/source/platformWin32/winFileio.cpp +++ b/Engine/source/platformWin32/winFileio.cpp @@ -158,8 +158,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) Platform::clearExcludedDirectories(); - S32 tempBufSize = to.size * 3 + MAX_PATH * 3; - TempAlloc< char > tempBuf( tempBufSize ); + TempAlloc< char > tempBuf( to.size * 3 + MAX_PATH * 3 ); // Create all the directories. for (S32 i = 0; i < directoryInfo.size(); i++) @@ -169,7 +168,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toDir = tempBuf; Platform::makeFullPathName(fromDir + dStrlen(fromName) + (dStricmp(fromDir, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); if(*(toDir + dStrlen(toDir) - 1) != '/') - dStrcat(toDir, "/", tempBufSize); + dStrcat(toDir, "/", tempBuf.size); forwardslash(toDir); if (!Platform::createPath(toDir)) @@ -192,8 +191,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toFile = tempBuf; Platform::makeFullPathName(fileInfo[i].pFullPath + dStrlen(fromName) + (dStricmp(fileInfo[i].pFullPath, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); - dStrcat(toFile, "/", tempBufSize); - dStrcat(toFile, fileInfo[i].pFileName, tempBufSize); + dStrcat(toFile, "/", tempBuf.size); + dStrcat(toFile, fileInfo[i].pFileName, tempBuf.size); backslash(fromFile); backslash(toFile);