For all filename strings use PATH_MAX as size, make sure they are inited correctly and only fill them with snprintf instead of sprintf

This commit is contained in:
zicodxx 2011-06-06 21:19:38 +02:00
parent df7fa858bc
commit acf7052546
2 changed files with 4 additions and 3 deletions

View file

@ -2,7 +2,7 @@ D2X-Rebirth Changelog
20110606
--------
main/playsave.c: For all filename strings use PATH_MAX as size, make sure they are inited correctly and only fill them with snprintf instead of sprintf
main/menu.c, main/playsave.c: For all filename strings use PATH_MAX as size, make sure they are inited correctly and only fill them with snprintf instead of sprintf
20110604
--------

View file

@ -172,7 +172,7 @@ char playername_allowed_chars[] = "azAZ09__--";
int MakeNewPlayerFile(int allow_abort)
{
int x;
char filename[14];
char filename[PATH_MAX];
newmenu_item m;
char text[CALLSIGN_LEN+9]="";
@ -195,7 +195,8 @@ try_again:
strlwr(text);
sprintf( filename, GameArg.SysUsePlayersDir? "Players/%s.plr" : "%s.plr", text );
memset(filename, '\0', PATH_MAX);
snprintf( filename, PATH_MAX, GameArg.SysUsePlayersDir? "Players/%s.plr" : "%s.plr", text );
if (PHYSFSX_exists(filename,0))
{