am ad509fd4: Merge "Fix potential crash"
* commit 'ad509fd4a2c597ced8e53b0817f754cb2209b98a': Fix potential crash
This commit is contained in:
14
recovery.cpp
14
recovery.cpp
@@ -1036,11 +1036,15 @@ main(int argc, char **argv) {
|
||||
if (strncmp(update_package, "CACHE:", 6) == 0) {
|
||||
int len = strlen(update_package) + 10;
|
||||
char* modified_path = (char*)malloc(len);
|
||||
strlcpy(modified_path, "/cache/", len);
|
||||
strlcat(modified_path, update_package+6, len);
|
||||
printf("(replacing path \"%s\" with \"%s\")\n",
|
||||
update_package, modified_path);
|
||||
update_package = modified_path;
|
||||
if (modified_path) {
|
||||
strlcpy(modified_path, "/cache/", len);
|
||||
strlcat(modified_path, update_package+6, len);
|
||||
printf("(replacing path \"%s\" with \"%s\")\n",
|
||||
update_package, modified_path);
|
||||
update_package = modified_path;
|
||||
}
|
||||
else
|
||||
printf("modified_path allocation failed\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user