From c1bf2f9cf6cff6a579a059789c92ad6692b6271d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 26 Oct 2014 13:12:50 -0400 Subject: [PATCH] lakka: Fix possible null pointer dereferences in lakka_draw_items. --- frontend/menu/disp/lakka.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index 9cd9f16a80..76b6cadda2 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -388,17 +388,19 @@ static void lakka_draw_subitems(lakka_handle_t *lakka, int i, int j) static void lakka_draw_items(lakka_handle_t *lakka, int i) { int j; - menu_category_t *category = (menu_category_t*)&lakka->categories[i]; - menu_category_t *active_category = (menu_category_t*) - &lakka->categories[lakka->menu_active_category]; - menu_item_t *active_item = (menu_item_t*) - &active_category->items[active_category->active_item]; + menu_category_t *category = NULL; + menu_category_t *active_category = NULL; + menu_item_t *active_item = NULL; (void)active_item; if (!lakka) return; + category = (menu_category_t*) &lakka->categories[i]; + active_category = (menu_category_t*) &lakka->categories[lakka->menu_active_category]; + active_item = (menu_item_t*) &active_category->items[active_category->active_item]; + for(j = 0; j < category->num_items; j++) { menu_item_t *item = (menu_item_t*)&category->items[j];