Maintenance: HUD
prevent buffer overflow
This commit is contained in:
parent
3c0d5661b5
commit
4a2cbc7389
1 changed files with 4 additions and 5 deletions
|
@ -574,20 +574,19 @@ void HUD::textAlign(fntRenderer *rend, const char *s, int align,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// HUDText -- text container for TextList vector
|
// HUDText -- text container for TextList vector
|
||||||
|
|
||||||
|
|
||||||
HUDText::HUDText(fntRenderer *fnt, float x, float y, const char *s, int align, int d) :
|
HUDText::HUDText(fntRenderer *fnt, float x, float y, const char *s, int align, int d) :
|
||||||
_fnt(fnt),
|
_fnt(fnt),
|
||||||
_x(x),
|
_x(x),
|
||||||
_y(y),
|
_y(y),
|
||||||
_digits(d)
|
_digits(d)
|
||||||
{
|
{
|
||||||
strncpy(_msg, s, BUFSIZE);
|
strncpy(_msg, s, BUFSIZE - 1);
|
||||||
|
_msg[BUFSIZE - 1] = '\0';
|
||||||
|
|
||||||
if (!align || !s[0])
|
if (!align || !s[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float ign;
|
float ign;
|
||||||
HUD::textAlign(fnt, s, align, &_x, &_y, &ign, &ign, &ign, &ign);
|
HUD::textAlign(fnt, s, align, &_x, &_y, &ign, &ign, &ign, &ign);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue