mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-29 23:42:25 +00:00
Make sure that strings are null terminated.
This is a noop, it just adds some safety. This was reported by maraakate in yquake2 issue #160.
This commit is contained in:
parent
fbf505834f
commit
b58a3ae131
1 changed files with 4 additions and 4 deletions
|
@ -774,10 +774,10 @@ WriteGame(const char *filename, qboolean autosave)
|
||||||
memset(str_os, 0, sizeof(str_os));
|
memset(str_os, 0, sizeof(str_os));
|
||||||
memset(str_arch, 0, sizeof(str_arch));
|
memset(str_arch, 0, sizeof(str_arch));
|
||||||
|
|
||||||
strncpy(str_ver, SAVEGAMEVER, sizeof(str_ver));
|
strncpy(str_ver, SAVEGAMEVER, sizeof(str_ver) - 1);
|
||||||
strncpy(str_game, GAMEVERSION, sizeof(str_game));
|
strncpy(str_game, GAMEVERSION, sizeof(str_game) - 1);
|
||||||
strncpy(str_os, OSTYPE, sizeof(str_os));
|
strncpy(str_os, OSTYPE, sizeof(str_os) - 1);
|
||||||
strncpy(str_arch, ARCH, sizeof(str_arch));
|
strncpy(str_arch, ARCH, sizeof(str_arch) - 1);
|
||||||
|
|
||||||
fwrite(str_ver, sizeof(str_ver), 1, f);
|
fwrite(str_ver, sizeof(str_ver), 1, f);
|
||||||
fwrite(str_game, sizeof(str_game), 1, f);
|
fwrite(str_game, sizeof(str_game), 1, f);
|
||||||
|
|
Loading…
Reference in a new issue