metadata_object.c : Fix handling of zero length vorbis comment string.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 23 Mar 2014 10:40:54 +0000 (21:40 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 23 Mar 2014 10:41:01 +0000 (21:41 +1100)
Previously if a zero length string was passed in, the pointer would be
stored regardless of the copy parameter. If the original source pointer
was reassigned to something else bad things could happen.

Closes:  https://sourceforge.net/p/flac/bugs/377/

src/libFLAC/metadata_object.c

index 5503238..40b7b9b 100644 (file)
@@ -264,7 +264,7 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S
 
        save = dest->entry;
 
-       if(0 != src->entry && src->length > 0) {
+       if(0 != src->entry) {
                if(copy) {
                        /* do the copy first so that if we fail we leave the dest object untouched */
                        if(!copy_vcentry_(dest, src))