mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-24 21:12:27 +00:00
Fix the bug with potential memory overwrite in Info_SetValueForStarKey
This commit is contained in:
parent
7fa170c325
commit
36b83eae86
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue