]> O.S.I.I.S - jp/vkvg.git/commitdiff
Fix strcpy invalid write size (#111)
authorMarco Rubin <20150305+Rubo3@users.noreply.github.com>
Sun, 13 Mar 2022 07:13:39 +0000 (08:13 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Mar 2022 07:13:39 +0000 (08:13 +0100)
`strcpy` copies the terminating NULL-character, too.

src/vkvg_fonts.c

index a4dce4166e9047a6826d0f701bbd947902ff4dfd..1b6ee191017b70e61043cfeb6696c2bfbffcbbf2 100644 (file)
@@ -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) {