- made D_WriteUserInfoStrings memory safe.

Its callers are anything but for now but this function was the main blocker for refactoring so it had to come first.
This commit is contained in:
Christoph Oelckers 2023-03-26 09:27:26 +02:00 committed by nashmuhandes
commit 5a36680a11
4 changed files with 65 additions and 61 deletions

View file

@ -2621,10 +2621,12 @@ void G_BeginRecording (const char *startmap)
{
if (playeringame[i])
{
StartChunk (UINF_ID, &demo_p);
WriteByte ((uint8_t)i, &demo_p);
D_WriteUserInfoStrings (i, &demo_p);
FinishChunk (&demo_p);
StartChunk(UINF_ID, &demo_p);
WriteByte((uint8_t)i, &demo_p);
auto str = D_GetUserInfoStrings(i);
memcpy(demo_p, str.GetChars(), str.Len() + 1);
demo_p += str.Len();
FinishChunk(&demo_p);
}
}