summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-11 22:40:09 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-08-11 22:40:09 -0400
commit235e41578be60135c8ad682e05440a5b9142ce69 (patch)
tree797a7aed5d10c2a026feabec5d1e7b99e9646277
parent30945f1180962e013c049dcd433697c8a91b1b4c (diff)
downloadrockbox-235e41578be60135c8ad682e05440a5b9142ce69.tar.gz
rockbox-235e41578be60135c8ad682e05440a5b9142ce69.zip
metadata/mp3data.c init vars & add sanity checks
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
-rw-r--r--lib/rbcodec/metadata/mp3data.c10
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. */