summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-31 07:01:04 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-12-31 07:04:18 -0500
commit855540e1f5af2836f4b6252a766fec13233e2fe5 (patch)
tree04f5cf24e1116e5085dcfb6054d63bc1e8f73b99
parent1773e56447785931968d46002b73307c1fb3a35a (diff)
downloadrockbox-855540e1f5af2836f4b6252a766fec13233e2fe5.tar.gz
rockbox-855540e1f5af2836f4b6252a766fec13233e2fe5.zip
[BugFix] keyremap browse missing root, entry count off by 1
browse_context was missing its root causing a NULL deref Export User Keys was looking for at least 4 entries when it only needed 3 Change-Id: If92ecccb36bd54e1b850ac2a969fe262b5d7fd14
-rw-r--r--apps/plugins/keyremap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/plugins/keyremap.c b/apps/plugins/keyremap.c
index 3923cc40d0..ccf446d279 100644
--- a/apps/plugins/keyremap.c
+++ b/apps/plugins/keyremap.c
@@ -521,9 +521,11 @@ static int keyremap_export_current(char *filenamebuf, size_t bufsz)
521 521
522 int entry_count = ctx_data.ctx_count + ctx_data.act_count + 1;;/* (ctx_count + ctx_count + act_count + 1) */ 522 int entry_count = ctx_data.ctx_count + ctx_data.act_count + 1;;/* (ctx_count + ctx_count + act_count + 1) */
523 523
524 if (entry_count <= 3) 524 if (entry_count < 3)
525 {
526 logf("%s: Not enough entries", __func__);
525 return 0; 527 return 0;
526 528 }
527 int fd = rb->open(filenamebuf, O_WRONLY | O_CREAT | O_TRUNC, 0666); 529 int fd = rb->open(filenamebuf, O_WRONLY | O_CREAT | O_TRUNC, 0666);
528 530
529 if (fd < 0) 531 if (fd < 0)
@@ -620,6 +622,7 @@ static void keyremap_import_user_keys(void)
620 .icon = Icon_Plugin, 622 .icon = Icon_Plugin,
621 .buf = buf, 623 .buf = buf,
622 .bufsize = sizeof(buf), 624 .bufsize = sizeof(buf),
625 .root = "/",
623 }; 626 };
624 627
625 if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) 628 if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS)