From 3516d8fc1daf88716a3648878c961b2cee549d7e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 4 Jan 2009 21:24:22 +0100 Subject: tag: allocate space for null terminator in clear_non_printable() Use g_strndup() instead of g_memdup(). --- src/tag.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/tag.c') diff --git a/src/tag.c b/src/tag.c index df32585c4..e7ce51c15 100644 --- a/src/tag.c +++ b/src/tag.c @@ -483,9 +483,7 @@ clear_non_printable(const char *p, size_t length) if (first == NULL) return NULL; - /* duplicate and null-terminate the string */ - dest = g_memdup(p, length); - dest[length] = 0; + dest = g_strndup(p, length); for (size_t i = first - p; i < length; ++i) if (char_is_non_printable(dest[i])) -- cgit v1.2.3