aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-04 21:24:22 +0100
committerMax Kellermann <max@duempel.org>2009-01-04 21:24:22 +0100
commit3516d8fc1daf88716a3648878c961b2cee549d7e (patch)
tree3fe1352a88ee9ff5bc1ac638d2fbdb91b01dacc8
parent200ef56d4dfbcead7e20d036352f20cd67612772 (diff)
downloadmpd-3516d8fc1daf88716a3648878c961b2cee549d7e.tar.gz
mpd-3516d8fc1daf88716a3648878c961b2cee549d7e.tar.xz
mpd-3516d8fc1daf88716a3648878c961b2cee549d7e.zip
tag: allocate space for null terminator in clear_non_printable()
Use g_strndup() instead of g_memdup().
-rw-r--r--src/tag.c4
1 files changed, 1 insertions, 3 deletions
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]))