Skip to content

Commit 6f881ce

Browse files
Zegerieagleivg
authored andcommitted
Replace sprintf_s with xr_sprintf
Our replacement of sprintf_s in Common/PlatformLinux.inl is faulty and should be avoided. Check it: sprintf_s(x, "Works? %s", "no") and look at x's value.
1 parent c03aa99 commit 6f881ce

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Layers/xrRenderPC_GL/rgl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ HRESULT CRender::shader_compile(
12751275
size_t def_len = def_it * 5;
12761276
size_t sources_len = source.size() + def_len + 2;
12771277
string256 name_comment;
1278-
sprintf_s(name_comment, "// %s\n", name);
1278+
xr_sprintf(name_comment, "// %s\n", name);
12791279
const char** sources = xr_alloc<const char*>(sources_len);
12801280
#ifdef DEBUG
12811281
sources[0] = "#version 450\n#pragma optimize (off)\n";

src/xrGame/game_cl_mp_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ LPCSTR game_cl_mp_script::GetRoundTime()
6767

6868
split_time(dt, year, month, day, hours, mins, secs, milisecs);
6969

70-
sprintf_s(bufTime, "%02i:%02i", mins, secs);
70+
xr_sprintf(bufTime, "%02i:%02i", mins, secs);
7171

7272
return bufTime;
7373
}

src/xrGame/xr_Client_BattlEye.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void BattlEyeClient::PrintMessage(char* message)
7272
// if ( g_be_message_out )
7373
{
7474
string512 text;
75-
sprintf_s(text, sizeof(text), "BattlEye Client: %s", message);
75+
xr_sprintf(text, sizeof(text), "BattlEye Client: %s", message);
7676
Msg("%s", text);
7777

7878
if (g_be_message_out) //==2

src/xrGame/xr_Server_BattlEye.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void BattlEyeServer::PrintMessage(char* message)
122122
// if( g_be_message_out )
123123
{
124124
string512 text;
125-
sprintf_s(text, sizeof(text), "BattlEye Server: %s", message);
125+
xr_sprintf(text, sizeof(text), "BattlEye Server: %s", message);
126126
Msg("%s", text);
127127

128128
if (g_be_message_out) //==2

0 commit comments

Comments
 (0)