Commit 6520589a authored by Max Kellermann's avatar Max Kellermann

TagString: use strndup() for unterminated string

Fixes buffer overflow bug.
parent f445b017
...@@ -39,7 +39,7 @@ patch_utf8(const char *src, size_t length, const gchar *end) ...@@ -39,7 +39,7 @@ patch_utf8(const char *src, size_t length, const gchar *end)
{ {
/* duplicate the string, and replace invalid bytes in that /* duplicate the string, and replace invalid bytes in that
buffer */ buffer */
char *dest = xstrdup(src); char *dest = xstrndup(src, length);
do { do {
dest[end - src] = '?'; dest[end - src] = '?';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment