TagString: use g_strndup() for unterminated string

Fixes buffer overflow bug.
This commit is contained in:
Max Kellermann 2014-10-10 22:06:48 +02:00
parent 432ce9b1de
commit c37f7abb79

View File

@ -33,7 +33,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 = g_strdup(src); char *dest = g_strndup(src, length);
do { do {
dest[end - src] = '?'; dest[end - src] = '?';