diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-08-30 22:01:35 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-08-30 22:01:35 +0000 |
commit | ae17b526ff69cfa3c02078cd5b6cfc1c6aa61de7 (patch) | |
tree | 7b050243afec7a24b720f2acc54f38289ba8fdd1 /firmware | |
parent | 51ca48ba0dd09bbfe0feeefe9496d4be036f74a7 (diff) |
Better handling of garbage in ID3V2 tags
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2090 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/id3.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index d97e7b7986..d83285568f 100644 --- a/firmware/id3.c +++ b/firmware/id3.c @@ -159,9 +159,9 @@ static bool setid3v1title(int fd, struct mp3entry *entry) */ static void setid3v2title(int fd, struct mp3entry *entry) { - unsigned int minframesize; + int minframesize; int size; - unsigned int readsize = 0, headerlen; + int readsize = 0, headerlen; char *title = NULL; char *artist = NULL; char *album = NULL; @@ -181,7 +181,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) return; version = (unsigned short int)header[3]; - + /* Read all frames in the tag */ size = entry->id3v2len - 10; @@ -193,7 +193,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) *(buffer + size) = '\0'; - /* Set minimun frame size according to ID3v2 version */ + /* Set minimum frame size according to ID3v2 version */ if(version > 2) minframesize = 12; else @@ -218,7 +218,9 @@ static void setid3v2title(int fd, struct mp3entry *entry) (header[4] << 8) + (header[5]); } - if(headerlen < 1) + + /* Continue if the frame length seems bad */ + if(headerlen > size) continue; /* Check for certain frame headers */ |