null terminate script. wrapping menus. 1.7.7

This commit is contained in:
Koushik K. Dutta 2010-03-23 11:44:33 -07:00
parent 581bd861d1
commit 707fa6d289
4 changed files with 6 additions and 8 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);

4
ui.c
View File

@ -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) {