Fix the bug with potential memory overwrite in Info_SetValueForStarKey

This commit is contained in:
Anton E. Gavrilov 2001-11-11 15:03:33 +00:00
parent 7fa170c325
commit 36b83eae86

View file

@ -240,7 +240,7 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize, int fl
// key exists, make sure we have enough room for new value, if we
// don't,
// don't change it!
if (strlen (value) - strlen (v) + strlen (s) > maxsize) {
if (strlen (value) - strlen (v) + strlen (s) >= maxsize) {
Con_Printf ("Info string length exceeded\n");
return;
}
@ -251,7 +251,7 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize, int fl
snprintf (newstr, sizeof (newstr), "\\%s\\%s", key, value);
if ((int) (strlen (newstr) + strlen (s)) > maxsize) {
if ((int) (strlen (newstr) + strlen (s)) >= maxsize) {
Con_Printf ("Info string length exceeded\n");
return;
}