- cap the size of the string copy calls in LevelStatEntry()

This commit is contained in:
Rachael Alexanderson 2024-10-25 19:14:58 -04:00
parent a14bba3561
commit fe28defeca
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0

View file

@ -343,8 +343,12 @@ static void LevelStatEntry(FSessionStatistics *es, const char *level, const char
time (&clock);
lt = localtime (&clock);
strcpy(s.name, level);
strcpy(s.info, text);
strncpy(s.name, level, sizeof(s.name) - 1);
s.name[sizeof(s.name) - 1] = '\0';
strncpy(s.info, text, sizeof(s.info) - 1);
s.info[sizeof(s.info) - 1] = '\0';
s.timeneeded=playtime;
es->levelstats.Push(s);
}