diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 22:40:09 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 22:40:09 -0400 |
commit | 235e41578be60135c8ad682e05440a5b9142ce69 (patch) | |
tree | 797a7aed5d10c2a026feabec5d1e7b99e9646277 | |
parent | 30945f1180962e013c049dcd433697c8a91b1b4c (diff) |
metadata/mp3data.c init vars & add sanity checks
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
-rw-r--r-- | lib/rbcodec/metadata/mp3data.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rbcodec/metadata/mp3data.c b/lib/rbcodec/metadata/mp3data.c index 664084021c..a6a44851fc 100644 --- a/lib/rbcodec/metadata/mp3data.c +++ b/lib/rbcodec/metadata/mp3data.c @@ -216,7 +216,9 @@ static bool headers_have_same_type(unsigned long header1, static void read_uint32be_mp3data(int fd, unsigned long *data) { *data = 0; - (void)read(fd, (char*)data, 4); + unsigned long ret; + if (read(fd, (char*)&ret, sizeof(ret)) == sizeof(ret)) + *data = ret; #ifndef ROCKBOX_BIG_ENDIAN *data = betoh32(*data); #endif @@ -769,7 +771,11 @@ int create_xing_header(int fd, long startpos, long filesize, last_pos = pos; } } - + else + { + memset(toc, 0, sizeof(toc)); + } + /* Use the template header and create a new one. We ignore the Protection bit even if the rest of the stream is protected. */ |