mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
[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:
parent
b07d7d6af0
commit
1643e0e287
1 changed files with 5 additions and 2 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue