From: Marco Rubin <20150305+Rubo3@users.noreply.github.com> Date: Sun, 13 Mar 2022 07:13:39 +0000 (+0100) Subject: Fix strcpy invalid write size (#111) X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=ad2d781dd51751f0325537f1de230798d2225207;p=jp%2Fvkvg.git Fix strcpy invalid write size (#111) `strcpy` copies the terminating NULL-character, too. --- diff --git a/src/vkvg_fonts.c b/src/vkvg_fonts.c index a4dce41..1b6ee19 100644 --- a/src/vkvg_fonts.c +++ b/src/vkvg_fonts.c @@ -375,7 +375,7 @@ void _font_add_name (_vkvg_font_identity_t* font, const char* name, int nameLeng else font->names = (char**) realloc (font->names, font->namesCount * sizeof(char*)); - font->names[font->namesCount-1] = (char*)calloc(nameLength, sizeof (char)); + font->names[font->namesCount-1] = (char*)calloc(nameLength + 1, sizeof (char)); strcpy (font->names[font->namesCount-1], name); } bool _font_cache_load_font_file_in_memory (_vkvg_font_identity_t* fontId) {