Fix allocating insufficient memory for terminating null of the string
This commit is contained in:
parent
b1762935c3
commit
38569f2f2e
|
@ -334,8 +334,8 @@ FcNameConvert (FcType type, FcChar8 *string)
|
||||||
size_t len = strlen ((const char *) string);
|
size_t len = strlen ((const char *) string);
|
||||||
int si, ei;
|
int si, ei;
|
||||||
|
|
||||||
sc = malloc (len);
|
sc = malloc (len + 1);
|
||||||
ec = malloc (len);
|
ec = malloc (len + 1);
|
||||||
if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2)
|
if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2)
|
||||||
{
|
{
|
||||||
if (FcNameConstant ((const FcChar8 *) sc, &si) &&
|
if (FcNameConstant ((const FcChar8 *) sc, &si) &&
|
||||||
|
|
Loading…
Reference in New Issue