X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=ft2.c;h=bc9544f2153f6f345083ce2ea35f47d000e714e0;hb=2937911fa171352791452035f4576b99971b6b56;hp=1711aded978e8985cc64632adc88c40210a463bc;hpb=17e35850369cf01ca9af0e90112bb5238ab51ca9;p=xonotic%2Fdarkplaces.git diff --git a/ft2.c b/ft2.c index 1711aded..bc9544f2 100644 --- a/ft2.c +++ b/ft2.c @@ -629,6 +629,11 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti font->settings = settings; namelen = strlen(name); + if (namelen + 5 > sizeof(filename)) + { + Con_Printf("WARNING: too long font name. Cannot load this.\n"); + return false; + } // try load direct file memcpy(filename, name, namelen+1); @@ -698,7 +703,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti Con_Printf("Failed to add attachment %u to %s\n", (unsigned)i, font->name); } - memcpy(font->name, name, namelen+1); + strlcpy(font->name, name, sizeof(font->name)); font->image_font = false; font->has_kerning = !!(((FT_Face)(font->face))->face_flags & FT_FACE_FLAG_KERNING); return true;