metadata_object.c : Fix handling of zero length vorbis comment string.

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/
This commit is contained in:
Erik de Castro Lopo 2014-03-23 21:40:54 +11:00
parent 697dbdee8f
commit 49d9d742e2

View 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))