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:
Yamagi Burmeister 2016-12-17 11:47:43 +01:00
parent 025364677c
commit 9b8bb03df7

View file

@ -785,10 +785,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));
Q_strlcpy(str_ver, SAVEGAMEVER, sizeof(str_ver)); Q_strlcpy(str_ver, SAVEGAMEVER, sizeof(str_ver) - 1);
Q_strlcpy(str_game, GAMEVERSION, sizeof(str_game)); Q_strlcpy(str_game, GAMEVERSION, sizeof(str_game) - 1);
Q_strlcpy(str_os, YQ2OSTYPE, sizeof(str_os)); Q_strlcpy(str_os, YQ2OSTYPE, sizeof(str_os) - 1);
Q_strlcpy(str_arch, YQ2ARCH, sizeof(str_arch)); Q_strlcpy(str_arch, YQ2ARCH, 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);