Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/GameUI/scriptobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void CScriptObject::WriteToConfig( )

if ( pItem )
{
V_sprintf_safe( szValue, "%s", pItem->szValue );
V_strcpy_safe( szValue, pItem->szValue );
V_StripInvalidCharacters( szValue );
}
else //Couldn't find index
Expand Down
2 changes: 1 addition & 1 deletion common/vscript_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ inline bool ScriptVmStringFromVariant( ScriptVariant_t &varValue, char (&chScrat
V_sprintf_safe( chScratchBuffer, "%c", ( char ) varValue );
return true;
case FIELD_CSTRING:
V_sprintf_safe( chScratchBuffer, "%s", ( const char * ) varValue );
V_strcpy_safe( chScratchBuffer, ( const char * ) varValue );
return true;
default:
Warning( "ScriptVmStringFromVariant failed to unpack parameter variant type %d\n", varValue.GetType() );
Expand Down
2 changes: 1 addition & 1 deletion dedicated/sys_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const char *PrefixMessageGroup(char (&out)[out_size], const char *group,
if (length > 1 && message[length - 1] == '\n') {
V_sprintf_safe(out, "[%.3f][%s] %s", Plat_FloatTime(), out_group, message);
} else {
V_sprintf_safe(out, "%s", message);
V_strcpy_safe(out, message);
}

return out;
Expand Down
2 changes: 1 addition & 1 deletion engine/DownloadListGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void CDownloadListGenerator::OnLevelLoadStart(const char *levelName)
Q_FixSlashes( m_gameDir );

// save off the map name
Q_snprintf( m_mapName, sizeof( m_mapName ), "%s", levelName );
V_strcpy_safe( m_mapName, levelName );
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion engine/audio/private/snd_dev_xaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const char *PrefixMessageGroup(char (&out)[out_size], const char *group,
if (length > 1 && message[length - 1] == '\n') {
V_sprintf_safe(out, "[%.3f][%s] %s", Plat_FloatTime(), group, message);
} else {
V_sprintf_safe(out, "%s", message);
V_strcpy_safe(out, message);
}

return out;
Expand Down
2 changes: 1 addition & 1 deletion engine/audio/private/vox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ void VOX_TouchSound( const char *pszin, CUtlDict< int, int >& filelist, CUtlRBTr
for ( intp j = 0 ; j < c; ++j )
{
char name[ 256 ];
Q_snprintf( name, sizeof( name ), "%s", list[ j ].word );
V_strcpy_safe( name, list[ j ].word );

if ( !Q_strnicmp( name, "V_", 2 ) )
{
Expand Down
2 changes: 1 addition & 1 deletion engine/baseautocompletefilelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int CBaseAutoCompleteFileList::AutoCompletionFunc( char const *partial, char com

while ( findfn )
{
Q_snprintf( sz, sizeof( sz ), "%s", findfn );
V_strcpy_safe( sz, findfn );

bool add = false;
// Insert into lookup
Expand Down
7 changes: 5 additions & 2 deletions engine/baseclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "iregistry.h"
#include "sv_main.h"
#include "hltvserver.h"
#include <memory>

#ifdef REPLAY_ENABLED
#include "replay_internal.h"
Expand Down Expand Up @@ -1152,7 +1153,9 @@ void CBaseClient::SendSnapshot( CClientFrame *pFrame )

bool bFailedOnce = false;
write_again:
bf_write msg( "CBaseClient::SendSnapshot", m_SnapshotScratchBuffer, sizeof( m_SnapshotScratchBuffer ) );
// RaphaelIT7: Were deep in networking and the stack can easily get close to an overflow
static thread_local std::unique_ptr<unsigned int[]> pSnapshotScratchBuffer(new unsigned int[g_nScratchBufferSizeAsInt]);
bf_write msg( "CBaseClient::SendSnapshot", pSnapshotScratchBuffer.get(), SNAPSHOT_SCRATCH_BUFFER_SIZE );

TRACE_PACKET( ( "SendSnapshot(%d)\n", pFrame->tick_count ) );

Expand Down Expand Up @@ -1625,7 +1628,7 @@ const char *GetUserIDString( const USERID_t& id )
}
else
{
V_sprintf_safe( idstr, "%s", id.steamid.Render() );
V_strcpy_safe( idstr, id.steamid.Render() );
}
}
break;
Expand Down
3 changes: 1 addition & 2 deletions engine/baseclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ class CBaseClient : public IGameEventListener2, public IClient, public IClientMe
{
SNAPSHOT_SCRATCH_BUFFER_SIZE = 160000,
};

unsigned int m_SnapshotScratchBuffer[ SNAPSHOT_SCRATCH_BUFFER_SIZE / 4 ];
static constexpr int g_nScratchBufferSizeAsInt = SNAPSHOT_SCRATCH_BUFFER_SIZE / sizeof(unsigned int);

private:
void StartTrace( bf_write &msg );
Expand Down
6 changes: 3 additions & 3 deletions engine/bugreporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,11 +1275,11 @@ void CBugUIPanel::OnFileSelected( char const *fullpath )
//
// if ( baseDirFile )
// {
// V_sprintf_safe( inc.fixedname, "%s", inc.name+3 ); // strip the "..\"
// V_strcpy_safe( inc.fixedname, inc.name+3 ); // strip the "..\"
// }
// else
// {
// V_sprintf_safe( inc.fixedname, "%s", inc.name );
// V_strcpy_safe( inc.fixedname, inc.name );
// }
// V_FixSlashes( inc.fixedname );
//
Expand Down Expand Up @@ -1733,7 +1733,7 @@ void CBugUIPanel::OnSubmit()
}
else
{
Q_snprintf( title, sizeof( title ), "%s", temp );
V_strcpy_safe( title, temp );
}

Msg( "title: %s\n", title );
Expand Down
4 changes: 2 additions & 2 deletions engine/cdll_engine_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,7 @@ bool CEngineClient::StartDemoRecording( const char *pszFilename, const char *psz
}
else
{
V_sprintf_safe( szTemp, "%s", pszFilename );
V_strcpy_safe( szTemp, pszFilename );
}

// remove .dem extension if it exists
Expand Down Expand Up @@ -2246,7 +2246,7 @@ void CEngineClient::TakeScreenshot( const char *pszFilename, const char *pszFold
}
else
{
V_sprintf_safe( szFinal, "%s", pszFilename );
V_strcpy_safe( szFinal, pszFilename );
}

V_SetExtension( szFinal, ".tga" );
Expand Down
4 changes: 2 additions & 2 deletions engine/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ void CL_FullyConnected( void )
float map_loadtime_start = dev_loadtime_map_start.GetFloat();
if (map_loadtime_start > 0.0)
{
float elapsed = Plat_FloatTime() - map_loadtime_start;
float elapsed = static_cast<float>( Plat_FloatTime() - map_loadtime_start );
dev_loadtime_map_elapsed.SetValue( elapsed );

// Clear this for next time so we know we did.
Expand Down Expand Up @@ -1156,7 +1156,7 @@ void CL_TakeScreenshot(const char *name)

if ( !Q_isempty( cl_screenshotname.GetString() ) )
{
Q_snprintf( cl_snapshotname, sizeof( cl_snapshotname ), "%s", cl_screenshotname.GetString() );
V_strcpy_safe( cl_snapshotname, cl_screenshotname.GetString() );
}
}

Expand Down
4 changes: 2 additions & 2 deletions engine/cvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ static void PrintCommand( const ConCommand *cmd, bool logging, FileHandle_t& f )

// Names staring with +/- need to be wrapped in single quotes
char name[ 256 ];
Q_snprintf( name, sizeof( name ), "%s", cmd->GetName() );
V_strcpy_safe( name, cmd->GetName() );
if ( name[ 0 ] == '+' || name[ 0 ] == '-' )
{
Q_snprintf( name, sizeof( name ), "'%s'", cmd->GetName() );
Expand Down Expand Up @@ -820,7 +820,7 @@ void CCvarUtilities::CvarList( const CCommand &args )
if ( V_strieq( args[1],"log" ) && iArgs >= 3 )
{
char fn[256];
Q_snprintf( fn, sizeof( fn ), "%s", args[2] );
V_strcpy_safe( fn, args[2] );
f = g_pFileSystem->Open( fn,"wb" );
if ( f )
{
Expand Down
2 changes: 1 addition & 1 deletion engine/hltvserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ void CHLTVServer::UpdateStats( void )
else
{
// forward address
Q_snprintf( address, sizeof(address), "%s", m_RootServer.ToString() );
V_strcpy_safe( address, m_RootServer.ToString() );
}

event->SetString( "master", address );
Expand Down
2 changes: 1 addition & 1 deletion engine/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ char const * Host_CleanupConVarStringValue( char const *invalue )
{
static char clean[ 256 ];

V_sprintf_safe( clean, "%s", invalue );
V_strcpy_safe( clean, invalue );

// Don't mess with empty string
// Otherwise, if it appears numeric and has a decimal, try to strip all zeroes after decimal
Expand Down
2 changes: 1 addition & 1 deletion engine/host_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ CON_COMMAND( kickid, "Kick a player by userid or uniqueid, with a message." )
// NOTE: assumed to be one argument
else
{
Q_snprintf( szSearchString, sizeof( szSearchString ), "%s", pszArg1 );
V_strcpy_safe( szSearchString, pszArg1 );
}
}
// this is a userid
Expand Down
2 changes: 1 addition & 1 deletion engine/staticpropmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void CStaticProp::DisplayStaticPropInfo( int nInfoType )
switch( nInfoType )
{
case 1:
Q_snprintf( buf, sizeof( buf ), "%s", modelloader->GetName( m_pModel ) );
V_strcpy_safe( buf, modelloader->GetName( m_pModel ) );
break;

case 2:
Expand Down
6 changes: 3 additions & 3 deletions engine/sv_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ CON_COMMAND( removeid, "Remove a user ID from the ban list." )
{
bValid = id->steamid.IsValid();
if ( bValid )
V_sprintf_safe( szSearchString, "%s", id->steamid.Render() );
V_strcpy_safe( szSearchString, id->steamid.Render() );
}
}
else
Expand All @@ -590,7 +590,7 @@ CON_COMMAND( removeid, "Remove a user ID from the ban list." )

bValid = cSteamIDCheck.IsValid();
if ( bValid )
V_sprintf_safe( szSearchString, "%s", cSteamIDCheck.Render() );
V_strcpy_safe( szSearchString, cSteamIDCheck.Render() );
}
}

Expand Down Expand Up @@ -758,7 +758,7 @@ CON_COMMAND( banid, "Add a user ID to the ban list." )

bValid = cSteamIDCheck.IsValid();
if ( bValid )
V_sprintf_safe( szSearchString, "%s", cSteamIDCheck.Render() );
V_strcpy_safe( szSearchString, cSteamIDCheck.Render() );
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/sys_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ const char *PrefixMessageGroup(char (&out)[out_size], const char *group,
if (length > 1 && message[length - 1] == '\n') {
V_sprintf_safe(out, "[%.3f][%s] %s", Plat_FloatTime(), out_group, message);
} else {
V_sprintf_safe(out, "%s", message);
V_strcpy_safe(out, message);
}

return out;
Expand Down
7 changes: 2 additions & 5 deletions engine/vgui_drawtreepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,7 @@ void VGui_RecursivePrintTree(
// Bind data to pVal.
char name[1024];
const char *pInputName = ipanel->GetName( current );
if ( !Q_isempty( pInputName ) )
V_sprintf_safe( name, "%s", pInputName );
else
V_sprintf_safe( name, "%s", "(no name)" );
V_strcpy_safe( name, !Q_isempty( pInputName ) ? pInputName : "(no name)" );

if ( ipanel->IsMouseInputEnabled( current ) )
{
Expand Down Expand Up @@ -387,7 +384,7 @@ void VGui_RecursivePrintTree(
V_sprintf_safe( str, "%s - [%d]", name, kv->GetInt("alpha") );
}
else
V_sprintf_safe( str, "%s", name );
V_strcpy_safe( str, name );

pVal->SetString( "Text", str );
// dimhotepus: SetInt -> SetPtr
Expand Down
2 changes: 1 addition & 1 deletion filesystem/linux_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int FillDataStruct( FIND_DATA *dat )
dat->dwFileAttributes = !stat( szFullPath, &fileStat ) ? fileStat.st_mode : 0;

// now just put the filename in the output data
V_sprintf_safe( dat->cFileName, "%s", name->d_name );
V_strcpy_safe( dat->cFileName, name->d_name );

free( name );

Expand Down
2 changes: 1 addition & 1 deletion game/client/c_baseflex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void C_BaseFlex::SetupMappings( char const *pchFileRoot )
memset( m_PhonemeClasses, 0, sizeof( m_PhonemeClasses ) );

Emphasized_Phoneme *normal = &m_PhonemeClasses[ PHONEME_CLASS_NORMAL ];
Q_snprintf( normal->classname, sizeof( normal->classname ), "%s", pchFileRoot );
V_strcpy_safe( normal->classname, pchFileRoot );
normal->required = true;

Emphasized_Phoneme *weak = &m_PhonemeClasses[ PHONEME_CLASS_WEAK ];
Expand Down
2 changes: 1 addition & 1 deletion game/client/cdll_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, intp inbufsizebytes, OUT_Z_B
//!! change some key names into better names
char friendlyName[64];
bool bAddBrackets = false;
V_sprintf_safe( friendlyName, "%s", key );
V_strcpy_safe( friendlyName, key );
V_strupr( friendlyName );

const wchar_t* locName = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion game/client/cstrike/VGUI/cstrikespectatorgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ bool CCSMapOverview::CreateRadarImage(const char *mapName, const char * radarFil

// And need a vmt file to go with it.
char vmtFilename[MAX_PATH];
Q_snprintf(vmtFilename, MAX_PATH, "%s", fullRadarFileName);
V_strcpy_safe(vmtFilename, fullRadarFileName);
char *extension = &vmtFilename[Q_strlen(vmtFilename) - 3];
*extension++ = 'v';
*extension++ = 'm';
Expand Down
2 changes: 1 addition & 1 deletion game/client/cstrike/cs_hud_freezepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void CCSFreezePanel::SetActive( bool bActive )
}

char szKey[16];
Q_snprintf( szKey, sizeof(szKey), "%s", pKey );
V_strcpy_safe( szKey, pKey );
wchar_t wKey[16];
wchar_t wLabel[256];

Expand Down
2 changes: 1 addition & 1 deletion game/client/dod/dod_hud_freezepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void CDODFreezePanel::ShowSnapshotPanel( bool bShow )
if ( bShow )
{
char szKey[16];
Q_snprintf( szKey, sizeof(szKey), "%s", key );
V_strcpy_safe( szKey, key );
wchar_t wKey[16];
wchar_t wLabel[256];

Expand Down
2 changes: 1 addition & 1 deletion game/client/dod/dod_hud_hintdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool CDODHudHintDisplay::SetHintText( wchar_t *text )

//!! change some key names into better names
char friendlyName[64];
Q_snprintf( friendlyName, sizeof(friendlyName), "%s", key );
V_strcpy_safe( friendlyName, key );
Q_strupr( friendlyName );

g_pVGuiLocalize->ConvertANSIToUnicode( friendlyName, token, sizeof(token) );
Expand Down
6 changes: 3 additions & 3 deletions game/client/hud_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ void CLCD::LookupToken( char const *in, CUtlString& value )
case FIELD_STRING:
{
string_t *pString = (string_t *)((string_t *)pInputData + iIndex );
Q_snprintf( sz, sizeof( sz ), "%s", pString ? STRING( *pString ) : "" );
V_strcpy_safe( sz, pString ? STRING( *pString ) : "" );
}
break;
case FIELD_VECTOR:
Expand All @@ -1373,7 +1373,7 @@ void CLCD::LookupToken( char const *in, CUtlString& value )
break;

case FIELD_BOOLEAN:
Q_snprintf( sz, sizeof( sz ), "%s", *( ( const bool *)pInputData + iIndex ) ? "true" : "false" );
V_strcpy_safe( sz, *( ( const bool *)pInputData + iIndex ) ? "true" : "false" );
break;
case FIELD_INTEGER:
V_to_chars( sz, *( (const int *)pInputData + iIndex ));
Expand All @@ -1384,7 +1384,7 @@ void CLCD::LookupToken( char const *in, CUtlString& value )
break;

case FIELD_CHARACTER:
Q_snprintf( sz, sizeof( sz ), "%s", ((const char *)pInputData + iIndex ) );
V_strcpy_safe( sz, ((const char *)pInputData + iIndex ) );
break;
}

Expand Down
6 changes: 3 additions & 3 deletions game/client/hud_pdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void CPDumpPanel::DumpComparision( const char *classname, const char *fieldname,

DumpInfo *slot = &m_DumpEntityInfo[ idx ];

Q_snprintf( slot->classname, sizeof( slot->classname ), "%s", classname );
V_strcpy_safe( slot->classname, classname );
slot->networked = networked;
Q_snprintf( slot->fieldstring, sizeof( slot->fieldstring ), "%s %s",
fieldname,
Expand Down Expand Up @@ -318,7 +318,7 @@ void CPDumpPanel::Paint()
surface()->DrawSetTextFont( m_FontMedium );
surface()->DrawSetTextColor( Color( 0, 255, 100, 255 ) );
surface()->DrawSetTextPos( x[ col ] - 10, y );
Q_snprintf( sz, sizeof( sz ), "%s", slot->classname );
V_strcpy_safe( sz, slot->classname );
g_pVGuiLocalize->ConvertANSIToUnicode( sz, szconverted );
surface()->DrawPrintText( szconverted, V_wcslen( szconverted ) );

Expand All @@ -333,7 +333,7 @@ void CPDumpPanel::Paint()
surface()->DrawSetTextFont( m_FontSmall );
surface()->DrawSetTextColor( Color( r, g, b, a ) );
surface()->DrawSetTextPos( x[ col ], y );
Q_snprintf( sz, sizeof( sz ), "%s", slot->fieldstring );
V_strcpy_safe( sz, slot->fieldstring );
g_pVGuiLocalize->ConvertANSIToUnicode( sz, szconverted );
surface()->DrawPrintText( szconverted, V_wcslen( szconverted ) );

Expand Down
2 changes: 1 addition & 1 deletion game/client/in_steamcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void CInput::SteamControllerMove( float flFrametime, CUserCmd *cmd )
if ( ( data.bState && !state.bAwaitingDebounce ) || state.cmd[0] == '+' )
{
char cmdbuf[128];
Q_snprintf( cmdbuf, sizeof( cmdbuf ), "%s", state.cmd );
V_strcpy_safe( cmdbuf, state.cmd );
if ( !data.bState )
{
cmdbuf[0] = '-';
Expand Down
Loading
Loading