commit | 38569f2f2e2abc0f2a543f48a286e464d5052546 | [log] [tgz] |
---|---|---|
author | Akira TAGOH <akira@tagoh.org> | Thu Jul 19 08:31:59 2018 +0000 |
committer | Akira TAGOH <akira@tagoh.org> | Thu Jul 19 08:31:59 2018 +0000 |
tree | 3191a846f5126374f2dfbeb9cb13a21eae28cded | |
parent | b1762935c3db2bc611750c61ce9cb38b9008db6b [diff] |
Fix allocating insufficient memory for terminating null of the string
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 @@ 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) &&