From 2acd72313826596a86ad08ef8857f510a2555fb5 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Thu, 22 Nov 2012 01:31:50 +0100 Subject: idevicebackup: Fix crash if manifest is sent early on in the backup process --- tools/idevicebackup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/idevicebackup.c') 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; -- cgit v1.1-32-gdbae