null terminate script. wrapping menus. 1.7.7
diff --git a/Android.mk b/Android.mk
index 4143a5e..9e9e3fe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,7 +26,7 @@
 
 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 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 @@
     // 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 @@
         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) {