summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2023-02-08 20:05:52 +1030
committerAdrian Johnson <ajohnson@redneon.com>2023-02-08 20:05:52 +1030
commit4fbc2ea3869a5148529ee59161d78952b64bb697 (patch)
tree982ace2c3b6c6f7750da8bfcd04c4f6812345edb /src
parentf706ad5aa3cc3d628aa5f2cf88c4aea19f7ed91b (diff)
downloadcairo-4fbc2ea3869a5148529ee59161d78952b64bb697.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/cairo-truetype-subset.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 91ee0e90b..78c7dd5ec 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -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;
}
}