diff options
author | Tao Bao <tbao@google.com> | 2015-08-11 18:11:44 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-08-11 18:11:44 +0200 |
commit | ad509fd4a2c597ced8e53b0817f754cb2209b98a (patch) | |
tree | 20e0b8c930d0eb3097e8592f56b833dc82dd9e51 | |
parent | Merge "Use unique_ptr and unique_fd to manager FDs." (diff) | |
parent | Fix potential crash (diff) | |
download | android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar.gz android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar.bz2 android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar.lz android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar.xz android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.tar.zst android_bootable_recovery-ad509fd4a2c597ced8e53b0817f754cb2209b98a.zip |
-rw-r--r-- | recovery.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/recovery.cpp b/recovery.cpp index 515470f96..c683bae1d 100644 --- a/recovery.cpp +++ b/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"); |