mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 22:24:33 +00:00
Use strncat instead of strcat to prevent some buffer overflows
This commit is contained in:
parent
53f35e7fb1
commit
7769da9434
32 changed files with 147 additions and 134 deletions
|
|
@ -1552,25 +1552,25 @@ const char* DInputDevice::getJoystickAxesString()
|
|||
switch ( mObjInfo[i].mInst )
|
||||
{
|
||||
case SI_XAXIS:
|
||||
dStrcat( buf, "\tX" );
|
||||
dStrcat( buf, "\tX", 64 );
|
||||
break;
|
||||
case SI_YAXIS:
|
||||
dStrcat( buf, "\tY" );
|
||||
dStrcat( buf, "\tY", 64 );
|
||||
break;
|
||||
case SI_ZAXIS:
|
||||
dStrcat( buf, "\tZ" );
|
||||
dStrcat( buf, "\tZ", 64 );
|
||||
break;
|
||||
case SI_RXAXIS:
|
||||
dStrcat( buf, "\tR" );
|
||||
dStrcat( buf, "\tR", 64 );
|
||||
break;
|
||||
case SI_RYAXIS:
|
||||
dStrcat( buf, "\tU" );
|
||||
dStrcat( buf, "\tU", 64 );
|
||||
break;
|
||||
case SI_RZAXIS:
|
||||
dStrcat( buf, "\tV" );
|
||||
dStrcat( buf, "\tV", 64 );
|
||||
break;
|
||||
case SI_SLIDER:
|
||||
dStrcat( buf, "\tS" );
|
||||
dStrcat( buf, "\tS", 64 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
|||
|
||||
Platform::clearExcludedDirectories();
|
||||
|
||||
TempAlloc< char > tempBuf( to.size * 3 + MAX_PATH * 3 );
|
||||
S32 tempBufSize = to.size * 3 + MAX_PATH * 3;
|
||||
TempAlloc< char > tempBuf( tempBufSize );
|
||||
|
||||
// Create all the directories.
|
||||
for (S32 i = 0; i < directoryInfo.size(); i++)
|
||||
|
|
@ -168,7 +169,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, "/");
|
||||
dStrcat(toDir, "/", tempBufSize);
|
||||
forwardslash(toDir);
|
||||
|
||||
if (!Platform::createPath(toDir))
|
||||
|
|
@ -191,8 +192,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, "/");
|
||||
dStrcat(toFile, fileInfo[i].pFileName);
|
||||
dStrcat(toFile, "/", tempBufSize);
|
||||
dStrcat(toFile, fileInfo[i].pFileName, tempBufSize);
|
||||
|
||||
backslash(fromFile);
|
||||
backslash(toFile);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue