truetype: revert use of _cairo_strndup

3d102f25 changed the malloc/memcpy to _cairo_strndup but it won't work
in this case as the string may be UTF-16.
This commit is contained in:
Adrian Johnson 2023-02-08 20:05:52 +10:30
parent f706ad5aa3
commit 4fbc2ea386

View file

@ -1471,10 +1471,14 @@ find_name (tt_name_t *name, unsigned long size, int name_id, int platform, int e
if (offset + len > size)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
str = _cairo_strndup (((char*)name) + offset, len);
str = _cairo_malloc (len + 1);
if (str == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
memcpy (str,
((char*)name) + offset,
len);
str[len] = 0;
break;
}
}