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