Index: apps/metadata/id3tags.c =================================================================== --- apps/metadata/id3tags.c (revision 29294) +++ apps/metadata/id3tags.c (working copy) @@ -358,8 +358,7 @@ if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos) { /* At least part of the value was read, so we can safely try to - * parse it - */ + * parse it */ value = tag + desc_len + 1; value_len = bufferpos - (tag - entry->id3v2buf); @@ -368,8 +367,7 @@ entry->albumartist = tag; #if CONFIG_CODEC == SWCODEC } else { - value_len = parse_replaygain(tag, value, entry, tag, - value_len); + value_len = parse_replaygain(tag, value, entry, tag, value_len); #endif } } @@ -1040,6 +1038,12 @@ #endif if( tr->ppFunc ) bufferpos = tr->ppFunc(entry, tag, bufferpos); + + /* Trim. Take into account that multiple string contents will + * only be displayed up to their first null termination. All + * content after this null termination is obsolete and can be + * overwritten. */ + bufferpos -= (bytesread - strlen(tag)); /* Seek to the next frame */ if(framelen < totframelen) Index: apps/metadata/mp4.c =================================================================== --- apps/metadata/mp4.c (revision 29294) +++ apps/metadata/mp4.c (working copy) @@ -120,11 +120,17 @@ if (bytes_read) { - (*buffer)[bytes_read] = 0; - *dest = *buffer; - length = strlen(*buffer) + 1; - *buffer_left -= length; - *buffer += length; + /* Do not overwrite already available metadata. Especially when reading + * tags with e.g. multiple genres / artists. This way only the first + * of multiple entries is used, all following are dropped. */ + if (*dest == NULL) + { + (*buffer)[bytes_read] = 0; + *dest = *buffer; + length = strlen(*buffer) + 1; + *buffer_left -= length; + *buffer += length; + } } else { Index: apps/metadata/metadata_common.c =================================================================== --- apps/metadata/metadata_common.c (revision 29294) +++ apps/metadata/metadata_common.c (working copy) @@ -337,7 +337,10 @@ p = NULL; } - if (p) + /* Do not overwrite already available metadata. Especially when reading + * tags with e.g. multiple genres / artists. This way only the first + * of multiple entries is used, all following are dropped. */ + if (p!=NULL && *p==NULL) { len = strlen(value); len = MIN(len, buf_remaining - 1);