Commit 3516d8fc authored by Max Kellermann's avatar Max Kellermann

tag: allocate space for null terminator in clear_non_printable()

Use g_strndup() instead of g_memdup().
parent 200ef56d
...@@ -483,9 +483,7 @@ clear_non_printable(const char *p, size_t length) ...@@ -483,9 +483,7 @@ clear_non_printable(const char *p, size_t length)
if (first == NULL) if (first == NULL)
return NULL; return NULL;
/* duplicate and null-terminate the string */ dest = g_strndup(p, length);
dest = g_memdup(p, length);
dest[length] = 0;
for (size_t i = first - p; i < length; ++i) for (size_t i = first - p; i < length; ++i)
if (char_is_non_printable(dest[i])) if (char_is_non_printable(dest[i]))
......
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