diff options
Diffstat (limited to 'apps/metadata/mp4.c')
-rw-r--r-- | apps/metadata/mp4.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 706e621234..14aad2203c 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c | |||
@@ -117,11 +117,17 @@ static unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer, | |||
117 | 117 | ||
118 | if (bytes_read) | 118 | if (bytes_read) |
119 | { | 119 | { |
120 | (*buffer)[bytes_read] = 0; | 120 | /* Do not overwrite already available metadata. Especially when reading |
121 | *dest = *buffer; | 121 | * tags with e.g. multiple genres / artists. This way only the first |
122 | length = strlen(*buffer) + 1; | 122 | * of multiple entries is used, all following are dropped. */ |
123 | *buffer_left -= length; | 123 | if (*dest == NULL) |
124 | *buffer += length; | 124 | { |
125 | (*buffer)[bytes_read] = 0; | ||
126 | *dest = *buffer; | ||
127 | length = strlen(*buffer) + 1; | ||
128 | *buffer_left -= length; | ||
129 | *buffer += length; | ||
130 | } | ||
125 | } | 131 | } |
126 | else | 132 | else |
127 | { | 133 | { |