From 707fa6d28918283dc74b5b7cfb66d4dc431efc9a Mon Sep 17 00:00:00 2001 From: "Koushik K. Dutta" Date: Tue, 23 Mar 2010 11:44:33 -0700 Subject: [PATCH] null terminate script. wrapping menus. 1.7.7 --- Android.mk | 2 +- extendedcommands.c | 4 +++- install.c | 4 ---- ui.c | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Android.mk b/Android.mk index 4143a5e..9e9e3fe 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v1.7.5 +RECOVERY_VERSION := ClockworkMod Recovery v1.7.7 LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) diff --git a/extendedcommands.c b/extendedcommands.c index 36467b0..eee70f8 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -522,9 +522,11 @@ int run_script(char* filename, int delete_file) } int script_len = file_info.st_size; - char* script_data = (char*)malloc(script_len); + char* script_data = (char*)malloc(script_len + 1); FILE *file = fopen(filename, "rb"); fread(script_data, script_len, 1, file); + // supposedly not necessary, but let's be safe. + script_data[script_len] = '\0'; fclose(file); if (delete_file) remove(filename); diff --git a/install.c b/install.c index 5291b5c..bbdb854 100644 --- a/install.c +++ b/install.c @@ -242,10 +242,6 @@ handle_update_package(const char *path, ZipArchive *zip) // Update should take the rest of the progress bar. ui_print("Installing update...\n"); - if (register_package_root(zip, path) < 0) { - LOGE("Can't register package root\n"); - return INSTALL_ERROR; - } LOGI("Trying update-binary.\n"); int result = try_update_binary(path, zip); diff --git a/ui.c b/ui.c index e704d05..5ea4e42 100644 --- a/ui.c +++ b/ui.c @@ -522,8 +522,8 @@ int ui_menu_select(int sel) { old_sel = menu_sel; menu_sel = sel; - if (menu_sel < 0) menu_sel = 0; - if (menu_sel >= menu_items) menu_sel = menu_items-1; + if (menu_sel < 0) menu_sel = menu_items + menu_sel; + if (menu_sel >= menu_items) menu_sel = menu_sel - menu_items; if (menu_sel < menu_show_start && menu_show_start > 0) {