diff options
| author | Andrew Goodbody <andrew.goodbody@linaro.org> | 2025-07-02 10:24:16 +0100 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-07-08 18:15:20 -0600 |
| commit | 074e05952705972072f52128cf2e3ec2d8f35de6 (patch) | |
| tree | 45094c6a6d910a526fa565b55970348ce6254525 | |
| parent | c3b43eeaead77beef53a224c7d13346a0462b34d (diff) | |
boot: menu: Do not dereference pointer if pointer is NULL
scene_obj_find can return NULL but this is not checked for before
the return is dereferenced. Add a NULL check.
This issue was found by Smatch.
Also add a NULL check for str.
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
| -rw-r--r-- | boot/scene_menu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 8db6a2b2f4d..23404172093 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -571,14 +571,15 @@ int scene_menu_display(struct scene_obj_menu *menu) return log_msg_ret("txt", -EINVAL); str = expo_get_str(exp, txt->gen.str_id); - printf("%s\n\n", str); + printf("%s\n\n", str ? str : ""); } if (list_empty(&menu->item_head)) return 0; pointer = scene_obj_find(scn, menu->pointer_id, SCENEOBJT_TEXT); - pstr = expo_get_str(scn->expo, pointer->gen.str_id); + if (pointer) + pstr = expo_get_str(scn->expo, pointer->gen.str_id); list_for_each_entry(item, &menu->item_head, sibling) { struct scene_obj_txt *key = NULL, *label = NULL; |
