summaryrefslogtreecommitdiffstats
path: root/tools
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
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')
-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)
static char *mobilebackup_build_path(const char *backup_directory, const char *name, const char *extension)
{
- char* filename = (char*)malloc(strlen(name)+strlen(extension)+1);
+ char* filename = (char*)malloc(strlen(name)+(extension == NULL ? 0: strlen(extension))+1);
strcpy(filename, name);
- strcat(filename, extension);
+ if (extension != NULL)
+ strcat(filename, extension);
char *path = build_path(backup_directory, filename, NULL);
free(filename);
return path;