summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-11-22 01:31:50 +0100
committerGravatar Martin Szulecki2012-11-22 01:31:50 +0100
commit2acd72313826596a86ad08ef8857f510a2555fb5 (patch)
tree70ce1d673674d971e66e610f10ab1d8ae1068d1b /tools/idevicebackup.c
parent4b7a4ff8e5098912ce95fb4ef7264e9fb71c819f (diff)
downloadlibimobiledevice-2acd72313826596a86ad08ef8857f510a2555fb5.tar.gz
libimobiledevice-2acd72313826596a86ad08ef8857f510a2555fb5.tar.bz2
idevicebackup: Fix crash if manifest is sent early on in the backup process
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r--tools/idevicebackup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 7935477..dbba217 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -455,9 +455,10 @@ static int plist_strcmp(plist_t node, const char *str)
455 455
456static char *mobilebackup_build_path(const char *backup_directory, const char *name, const char *extension) 456static char *mobilebackup_build_path(const char *backup_directory, const char *name, const char *extension)
457{ 457{
458 char* filename = (char*)malloc(strlen(name)+strlen(extension)+1); 458 char* filename = (char*)malloc(strlen(name)+(extension == NULL ? 0: strlen(extension))+1);
459 strcpy(filename, name); 459 strcpy(filename, name);
460 strcat(filename, extension); 460 if (extension != NULL)
461 strcat(filename, extension);
461 char *path = build_path(backup_directory, filename, NULL); 462 char *path = build_path(backup_directory, filename, NULL);
462 free(filename); 463 free(filename);
463 return path; 464 return path;