TagString: use strndup() for unterminated string

Fixes buffer overflow bug.
This commit is contained in:
Max Kellermann 2014-10-10 22:06:48 +02:00
parent f445b0178a
commit 6520589a37

View File

@ -39,7 +39,7 @@ patch_utf8(const char *src, size_t length, const gchar *end)
{
/* duplicate the string, and replace invalid bytes in that
buffer */
char *dest = xstrdup(src);
char *dest = xstrndup(src, length);
do {
dest[end - src] = '?';