1
0
Fork 0
forked from len0rd/rockbox

Better handling of garbage in ID3V2 tags

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2090 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-08-30 22:01:35 +00:00
parent 51ca48ba0d
commit ae17b526ff

View file

@ -159,9 +159,9 @@ static bool setid3v1title(int fd, struct mp3entry *entry)
*/ */
static void setid3v2title(int fd, struct mp3entry *entry) static void setid3v2title(int fd, struct mp3entry *entry)
{ {
unsigned int minframesize; int minframesize;
int size; int size;
unsigned int readsize = 0, headerlen; int readsize = 0, headerlen;
char *title = NULL; char *title = NULL;
char *artist = NULL; char *artist = NULL;
char *album = NULL; char *album = NULL;
@ -181,7 +181,7 @@ static void setid3v2title(int fd, struct mp3entry *entry)
return; return;
version = (unsigned short int)header[3]; version = (unsigned short int)header[3];
/* Read all frames in the tag */ /* Read all frames in the tag */
size = entry->id3v2len - 10; size = entry->id3v2len - 10;
@ -193,7 +193,7 @@ static void setid3v2title(int fd, struct mp3entry *entry)
*(buffer + size) = '\0'; *(buffer + size) = '\0';
/* Set minimun frame size according to ID3v2 version */ /* Set minimum frame size according to ID3v2 version */
if(version > 2) if(version > 2)
minframesize = 12; minframesize = 12;
else else
@ -218,7 +218,9 @@ static void setid3v2title(int fd, struct mp3entry *entry)
(header[4] << 8) + (header[4] << 8) +
(header[5]); (header[5]);
} }
if(headerlen < 1)
/* Continue if the frame length seems bad */
if(headerlen > size)
continue; continue;
/* Check for certain frame headers */ /* Check for certain frame headers */