engine: sys_con: only allow names that start with either alphabetic or numerical character for a log file

This commit is contained in:
Alibek Omarov 2025-02-14 01:51:50 +03:00
parent f1a9d408bf
commit 89430400d9

View file

@ -81,7 +81,7 @@ void Sys_InitLog( void )
if( Sys_CheckParm( "-log" )) if( Sys_CheckParm( "-log" ))
{ {
if( !Sys_GetParmFromCmdLine( "-log", s_ld.log_path ) || s_ld.log_path[0] == '-' ) if( !Sys_GetParmFromCmdLine( "-log", s_ld.log_path ) || !isalnum( s_ld.log_path[0] ))
Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path )); Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path ));
COM_DefaultExtension( s_ld.log_path, ".log", sizeof( s_ld.log_path )); COM_DefaultExtension( s_ld.log_path, ".log", sizeof( s_ld.log_path ));