mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 19:55:23 +00:00
Switch netgame_info::server_config_name to dynamically allocated
Resolve an out-of-bounds write in LoadServerConfigFile. A sufficiently long path, descent3 -dedicated /home/jengelh/.config/descent3/dedicated.conf causes the game server to exit with Error loading connection DLL 'cated.conf' Which hints at a buffer overflow.
This commit is contained in:
parent
69dbf5bca7
commit
009645ac83
@ -328,7 +328,7 @@ int LoadServerConfigFile() {
|
||||
}
|
||||
|
||||
if (GameArgs[t + 1][0]) {
|
||||
strcpy(Netgame.server_config_name, GameArgs[t + 1]);
|
||||
Netgame.server_config_name = GameArgs[t + 1];
|
||||
} else {
|
||||
PrintDedicatedMessage(TXT_DS_MISSINGCONFIG);
|
||||
PrintDedicatedMessage("\n");
|
||||
@ -337,7 +337,7 @@ int LoadServerConfigFile() {
|
||||
|
||||
// open file
|
||||
if (!inf.Open(Netgame.server_config_name, "[server config file]", DedicatedServerLex)) {
|
||||
PrintDedicatedMessage(TXT_DS_BADCONFIG, Netgame.server_config_name);
|
||||
PrintDedicatedMessage(TXT_DS_BADCONFIG, Netgame.server_config_name.u8string().c_str());
|
||||
PrintDedicatedMessage("\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ typedef int HANDLE;
|
||||
#include "descent.h" //for MSN_NAMELEN
|
||||
#include "byteswap.h"
|
||||
#include <cassert>
|
||||
#include <filesystem>
|
||||
|
||||
#define NETGAME_NAME_LEN 32
|
||||
#define NETGAME_SCRIPT_LEN 32
|
||||
@ -249,7 +250,7 @@ struct netgame_info {
|
||||
char mission[MSN_NAMELEN];
|
||||
char mission_name[MISSION_NAME_LEN];
|
||||
char scriptname[NETGAME_SCRIPT_LEN];
|
||||
char server_config_name[PAGENAME_LEN];
|
||||
std::filesystem::path server_config_name;
|
||||
char connection_name[PAGENAME_LEN];
|
||||
network_address server_address; // The address of the server that we're talking to - not used if we are the server
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user