Fix allocating insufficient memory for terminating null of the string

This commit is contained in:
Akira TAGOH 2018-07-19 08:31:59 +00:00
parent b1762935c3
commit 38569f2f2e
1 changed files with 2 additions and 2 deletions

View File

@ -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) &&