Fix buffer overflow in ID3 decode

When the ID3 tag had >64 bytes of data for an element, there was a
1-byte out of bounds access, causing a crash at some later point in
time.  Properly limit writes to the ID3 field buffer.

Fixes #104
This commit is contained in:
Earle F. Philhower, III committed 2018-07-11 16:03:39 -07:00
1 parent 1f481a993a
commit c0ec26169c
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -218,12 +218,12 @@ uint32_t AudioFileSourceID3::read(void *data, uint32_t len)
if (i<sizeof(value)-1) value[i] = id3.getByte();
else (void)id3.getByte();
}
value[i] = 0; // Terminate the string...
value[i<sizeof(value)-1?i:sizeof(value)-1] = 0; // Terminate the string...
if ( (frameid[0]=='T' && frameid[1]=='A' && frameid[2]=='L' && frameid[3] == 'B' ) ||
(frameid[0]=='T' && frameid[1]=='A' && frameid[2]=='L' && rev==2) ) {
cb.md("Album", isUnicode, value);
} else if ( (frameid[0]=='T' && frameid[1]=='I' && frameid[2]=='T' && frameid[3] == '2') ||
(frameid[i]=='T' && frameid[1]=='T' && frameid[2]=='2' && rev==2) ) {
(frameid[0]=='T' && frameid[1]=='T' && frameid[2]=='2' && rev==2) ) {
cb.md("Title", isUnicode, value);
} else if ( (frameid[0]=='T' && frameid[1]=='P' && frameid[2]=='E' && frameid[3] == '1') ||
(frameid[0]=='T' && frameid[1]=='P' && frameid[2]=='1' && rev==2) ) {