SW: Fix -Wrestrict

git-svn-id: https://svn.eduke32.com/eduke32@7561 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-10 01:01:03 +00:00 committed by Christoph Oelckers
parent 5aec94bd60
commit 7ea2d2024b

View file

@ -2587,8 +2587,12 @@ MNU_InputSmallString(char *name, short pix_width)
MNU_MeasureSmallString(name, &w, &h);
if (w < pix_width)
{
if (strlen(name) < 256) // Dont let it go too far!
sprintf(name, "%s%c", name, ch);
size_t const namelen = strlen(name);
if (namelen < 256) // Dont let it go too far!
{
name[namelen] = ch;
name[namelen+1] = '\0';
}
}
}
@ -2687,7 +2691,9 @@ MNU_InputString(char *name, short pix_width)
MNU_MeasureString(name, &w, &h);
if (w < pix_width)
{
sprintf(name, "%s%c", name, ch);
size_t const namelen = strlen(name);
name[namelen] = ch;
name[namelen+1] = '\0';
}
}