From ad2d781dd51751f0325537f1de230798d2225207 Mon Sep 17 00:00:00 2001 From: Marco Rubin <20150305+Rubo3@users.noreply.github.com> Date: Sun, 13 Mar 2022 08:13:39 +0100 Subject: [PATCH] Fix strcpy invalid write size (#111) `strcpy` copies the terminating NULL-character, too. --- src/vkvg_fonts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.47.3