[Bugfix] metadata.c copy_mp3entry() dest and orig may overlap

I meant to add this with the last patch b07d7d6
since it may supply UNBUFFERED_ID3 to the peek function
which uses UNBUFFERED_ID3 and will try to copy it back
wich is undefined behavior for memcpy

Change-Id: I91160570adac22134c84d3b37f8fcecb097d87d6
This commit is contained in:
William Wilgus 2024-12-26 01:23:21 -05:00 committed by William Wilgus
parent b07d7d6af0
commit 1643e0e287

View file

@ -522,8 +522,11 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig)
{
memcpy(dest, orig, sizeof(struct mp3entry));
adjust_mp3entry(dest, dest, orig);
if (dest != orig)
{
memcpy(dest, orig, sizeof(struct mp3entry));
adjust_mp3entry(dest, dest, orig);
}
}
/* A shortcut to simplify the common task of clearing the struct */