From 4b7a623cc0fb1a0e81ab76352d168ec296a26a19 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 29 Mar 2012 05:28:09 +0000 Subject: [PATCH] Make sure font glyph shader names are null-terminated. --- code/renderer/tr_font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/renderer/tr_font.c b/code/renderer/tr_font.c index 330760bb..e1eb4868 100644 --- a/code/renderer/tr_font.c +++ b/code/renderer/tr_font.c @@ -397,8 +397,8 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { font->glyphs[i].s2 = readFloat(); font->glyphs[i].t2 = readFloat(); font->glyphs[i].glyph = readInt(); - Com_Memcpy(font->glyphs[i].shaderName, &fdFile[fdOffset], 32); - fdOffset += 32; + Q_strncpyz(font->glyphs[i].shaderName, (const char *)&fdFile[fdOffset], sizeof(font->glyphs[i].shaderName)); + fdOffset += sizeof(font->glyphs[i].shaderName); } font->glyphScale = readFloat(); Com_Memcpy(font->name, &fdFile[fdOffset], MAX_QPATH);