summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-08-11 18:30:38 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-11 18:30:38 +0200
commit62551d4a7412eb5fab0022e26399d56e6ddfafe6 (patch)
tree69c0f385575f4ada85d959900da5d3ad2d53bc6f
parentam 0d42440e: am 434a1761: am 0d46c7ab: Merge "Use unique_ptr and unique_fd to manager FDs." (diff)
parentam 4854e292: am ad509fd4: Merge "Fix potential crash" (diff)
downloadandroid_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar.gz
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar.bz2
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar.lz
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar.xz
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.tar.zst
android_bootable_recovery-62551d4a7412eb5fab0022e26399d56e6ddfafe6.zip
-rw-r--r--recovery.cpp14
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");