From e3e72d6dba080c31b717ee3b53a3fde181123766 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 11 Aug 2021 08:29:02 -0400 Subject: [PATCH] metadata/mp4.c fix small oversight / bug didn't set the genre string to null on case entry means read failure would leave genre string indeterminate add explicit NULL & leave genre uninitialized Change-Id: I1452a0b57985646c982ec80755d0df9d03745f1e --- lib/rbcodec/metadata/mp4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c index e79af3bd7b..41f38480b1 100644 --- a/lib/rbcodec/metadata/mp4.c +++ b/lib/rbcodec/metadata/mp4.c @@ -444,10 +444,10 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3, case MP4_gnre: { - unsigned short genre = USHRT_MAX; /*invalid genre*/ - unsigned long rd_ret; - rd_ret = read_mp4_tag(fd, size, (char*) &genre, sizeof(genre)); - if (rd_ret == sizeof(genre)) + unsigned short genre; + const unsigned int g_size = sizeof(genre); + id3->genre_string = NULL; + if (read_mp4_tag(fd, size, (char*) &genre, g_size) == g_size) id3->genre_string = id3_get_num_genre(betoh16(genre) - 1); } break;