Files @ r25360:c5efeb83c7e8
Branch filter:

Location: cpp/openttd-patchpack/source/regression/stationlist/info.nut

rubidium42
Fix: [Network] Reading beyond the length of the server's ID when hashing password

Under normal circumstances the server's ID is 32 characters excluding '\0', however this can be changed at the server. This ID is sent to the server for company name hashing. The client reads it into a statically allocated buffer of 33 bytes, but fills only the bytes it received from the server. However, the hash assumes all 33 bytes are set, thus potentially reading uninitialized data, or a part of the server ID of a previous game in the hashing routine.
It is still reading from memory assigned to the server ID, so nothing bad happens, except that company passwords might not work correctly.
class StationList extends AIInfo {
	function GetAuthor()      { return "OpenTTD NoAI Developers Team"; }
	function GetName()        { return "StationList"; }
	function GetShortName()   { return "REGS"; }
	function GetDescription() { return "This runs stationlist-tests on some commands. On the same map the result should always be the same."; }
	function GetVersion()     { return 1; }
	function GetAPIVersion()  { return "1.12"; }
	function GetDate()        { return "2007-03-18"; }
	function CreateInstance() { return "StationList"; }
	function UseAsRandomAI()  { return false; }
}

RegisterAI(StationList());