1
0
Fork 0

Maintenance: HUD

prevent buffer overflow
This commit is contained in:
Scott Giese 2021-02-20 23:38:33 -06:00
parent 3c0d5661b5
commit 4a2cbc7389

View file

@ -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);
} }