Fix unterminated string issue

This commit is contained in:
Akira TAGOH 2018-07-19 05:51:02 +00:00
parent 37c9c16dad
commit 51afd09d62
1 changed files with 4 additions and 1 deletions

View File

@ -193,10 +193,13 @@ FcDirCacheReadUUID (FcChar8 *dir,
if ((fd = FcOpen ((char *) uuidname, O_RDONLY)) >= 0)
{
char suuid[37];
ssize_t len;
memset (suuid, 0, sizeof (suuid));
if (read (fd, suuid, 36) > 0)
len = read (fd, suuid, 36);
if (len != -1)
{
suuid[len] = 0;
memset (uuid, 0, sizeof (uuid));
if (uuid_parse (suuid, uuid) == 0)
{