summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
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)
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;