diff --git a/Quake/pr_edict.c b/Quake/pr_edict.c index d178ff616..3f9723078 100644 --- a/Quake/pr_edict.c +++ b/Quake/pr_edict.c @@ -601,6 +601,7 @@ padded to 20 field width const char *PR_GlobalString (int ofs) { static char line[512]; + static const int lastchari = Q_COUNTOF(line) - 2; const char *s; int i; ddef_t *def; @@ -619,7 +620,11 @@ const char *PR_GlobalString (int ofs) i = strlen(line); for ( ; i < 20; i++) strcat (line, " "); - strcat (line, " "); + + if (i < lastchari) + strcat (line, " "); + else + line[lastchari] = ' '; return line; } @@ -627,6 +632,7 @@ const char *PR_GlobalString (int ofs) const char *PR_GlobalStringNoContents (int ofs) { static char line[512]; + static const int lastchari = Q_COUNTOF(line) - 2; int i; ddef_t *def; @@ -639,7 +645,11 @@ const char *PR_GlobalStringNoContents (int ofs) i = strlen(line); for ( ; i < 20; i++) strcat (line, " "); - strcat (line, " "); + + if (i < lastchari) + strcat (line, " "); + else + line[lastchari] = ' '; return line; }