summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openrecoveryscript.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 75686cfcc..cf6f598c5 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -309,12 +309,17 @@ int OpenRecoveryScript::run_script_file(void) {
gui_print("Unmounted '%s'\n", mount);
} else if (strcmp(command, "set") == 0) {
// Set value
+ size_t len = strlen(value);
tok = strtok(value, " ");
strcpy(value1, tok);
- tok = strtok(NULL, " ");
- strcpy(value2, tok);
- gui_print("Setting '%s' to '%s'\n", value1, value2);
- DataManager::SetValue(value1, value2);
+ if (len > strlen(value1) + 1) {
+ char *val2 = value + strlen(value1) + 1;
+ gui_print("Setting '%s' to '%s'\n", value1, val2);
+ DataManager::SetValue(value1, val2);
+ } else {
+ gui_print("Setting '%s' to empty\n", value1);
+ DataManager::SetValue(value1, "");
+ }
} else if (strcmp(command, "mkdir") == 0) {
// Make directory (recursive)
DataManager::SetValue("tw_action_text2", "Making Directory");