From 4ce8963c50f79981450ee10191e4e38e2c17386c Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 29 Nov 2024 00:25:03 -0500 Subject: [PATCH] [COV] tree.c rockbox_browse potential NULL deref ultimately its only used as a way to prevent reentry but coverity correctly identified the possibility.. Change-Id: I4738e52782ad4cac6134394238345a0491a50382 --- apps/tree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/tree.c b/apps/tree.c index c422100de8..e67d455062 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1064,8 +1064,14 @@ int rockbox_browse(struct browse_context *browse) { tc.is_browsing = (browse != NULL); int ret_val = 0; - int dirfilter = tc.is_browsing ? browse->dirfilter : SHOW_ALL; - + int dirfilter = SHOW_ALL; + if (tc.is_browsing) + dirfilter = browse->dirfilter; + else + { + debugf("%s browse is [NULL] \n", __func__); + browse = tc.browse; + } if (backup_count >= NUM_TC_BACKUP) return GO_TO_PREVIOUS; if (backup_count >= 0)