Commit c37f7abb authored by Max Kellermann's avatar Max Kellermann

TagString: use g_strndup() for unterminated string

Fixes buffer overflow bug.
parent 432ce9b1
...@@ -33,7 +33,7 @@ patch_utf8(const char *src, size_t length, const gchar *end) ...@@ -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] = '?';
......
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