Skip to content

Commit

Permalink
Fix format-security error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiangmoe committed Jan 3, 2025
1 parent ebc8083 commit 096d8bc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions common/wsproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ bool WinsockInterfaceClass::Set_Socket_Options(void)
if (err == INVALID_SOCKET) {
char out[128];
sprintf(out, "TS: Failed to set socket option SO_RCVBUF - error code %d.\n", LastSocketError);
fprintf(stderr, out);
fprintf(stderr, "%s", out);
assert(err != INVALID_SOCKET);
}

Expand All @@ -583,7 +583,7 @@ bool WinsockInterfaceClass::Set_Socket_Options(void)
if (err == INVALID_SOCKET) {
char out[128];
sprintf(out, "TS: Failed to set socket option SO_SNDBUF - error code %d.\n", LastSocketError);
fprintf(stderr, out);
fprintf(stderr, "%s", out);
assert(err != INVALID_SOCKET);
}

Expand Down
2 changes: 1 addition & 1 deletion redalert/cheklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void CheckListClass::Draw_Entry(int index, int x, int y, int width, int selected
buffer[0] = UNCHECK_CHAR;
}
buffer[1] = ' ';
sprintf(&buffer[2], obj->Text);
sprintf(&buffer[2], "%s", obj->Text);

TextPrintType flags = TextFlags;
RemapControlType* scheme = GadgetClass::Get_Color_Scheme();
Expand Down
2 changes: 1 addition & 1 deletion tiberiandawn/cheklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void CheckListClass::Draw_Entry(int index, int x, int y, int width, int selected
buffer[0] = UNCHECK_CHAR;
}
buffer[1] = ' ';
sprintf(&buffer[2], obj->Text);
sprintf(&buffer[2], "%s", obj->Text);

TextPrintType flags = TextFlags;

Expand Down
2 changes: 1 addition & 1 deletion tiberiandawn/netdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4076,7 +4076,7 @@ void Net_Reconnect_Dialog(int reconn, int fresh, int oldest_index, unsigned int
id = Ipx.Connection_ID(oldest_index);
sprintf(buf1, Text_String(TXT_RECONNECTING_TO), Ipx.Connection_Name(id));
} else {
sprintf(buf1, Text_String(TXT_WAITING_FOR_CONNECTIONS));
sprintf(buf1, "%s", Text_String(TXT_WAITING_FOR_CONNECTIONS));
}
sprintf(buf2, Text_String(TXT_TIME_ALLOWED), timeval + 1);
buf3 = Text_String(TXT_PRESS_ESC);
Expand Down

0 comments on commit 096d8bc

Please sign in to comment.