summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-11-29 00:25:03 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2024-11-29 00:25:03 -0500
commit4ce8963c50f79981450ee10191e4e38e2c17386c (patch)
treebb8d84460b89aad2d4c15afb21553e4e3cb546b9
parentc2bc7aa51698dfb793c8d3544fa6ecd7d257dcb4 (diff)
downloadrockbox-4ce8963c50.tar.gz
rockbox-4ce8963c50.zip
[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
-rw-r--r--apps/tree.c10
1 files 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)