From 38569f2f2e2abc0f2a543f48a286e464d5052546 Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Thu, 19 Jul 2018 08:31:59 +0000 Subject: [PATCH] Fix allocating insufficient memory for terminating null of the string --- src/fcname.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fcname.c b/src/fcname.c index c9320ae..711bb9b 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -334,8 +334,8 @@ FcNameConvert (FcType type, FcChar8 *string) size_t len = strlen ((const char *) string); int si, ei; - sc = malloc (len); - ec = malloc (len); + sc = malloc (len + 1); + ec = malloc (len + 1); if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2) { if (FcNameConstant ((const FcChar8 *) sc, &si) &&