diff options
| author | Marco Rubin <20150305+Rubo3@users.noreply.github.com> | 2022-03-13 08:13:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-13 08:13:39 +0100 |
| commit | ad2d781dd51751f0325537f1de230798d2225207 (patch) | |
| tree | 95d6167089a8deca841adee526d1ac44c78ec0b4 | |
| parent | 6f620a140042b6e3814da9f49da4129f60aa40b3 (diff) | |
Fix strcpy invalid write size (#111)
`strcpy` copies the terminating NULL-character, too.
| -rw-r--r-- | src/vkvg_fonts.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |