File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Core/GameEngine/Source/GameNetwork Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 5353#include " GameClient/DisconnectMenu.h"
5454#include " GameClient/InGameUI.h"
5555
56+ static Bool hasValidTransferFileExtension (const AsciiString& filePath)
57+ {
58+ static const char * const validExtensions[] = {
59+ " map" ,
60+ " ini" ,
61+ " str" ,
62+ " wak" ,
63+ " tga" ,
64+ " txt"
65+ };
66+
67+ const char * fileExt = strrchr (filePath.str (), ' .' );
68+
69+ if (fileExt == NULL || fileExt[1 ] == ' \0 ' )
70+ {
71+ return false ;
72+ }
73+
74+ fileExt++;
75+
76+ for (Int i = 0 ; i < ARRAY_SIZE (validExtensions); ++i)
77+ {
78+ if (stricmp (fileExt, validExtensions[i]) == 0 )
79+ {
80+ return true ;
81+ }
82+ }
83+
84+ return false ;
85+ }
5686
5787/* *
5888 * Le destructor.
@@ -665,6 +695,13 @@ void ConnectionManager::processFile(NetFileCommandMsg *msg)
665695 return ;
666696 }
667697
698+ // TheSuperHackers @security bobtista 06/11/2025 Validate file extension to prevent arbitrary file types
699+ if (!hasValidTransferFileExtension (realFileName))
700+ {
701+ DEBUG_LOG ((" File '%s' has invalid extension for transfer operations." , realFileName.str ()));
702+ return ;
703+ }
704+
668705 if (TheFileSystem->doesFileExist (realFileName.str ()))
669706 {
670707 DEBUG_LOG ((" File exists already!" ));
You can’t perform that action at this time.
0 commit comments