summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/idevicecrashreport.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 8502938..4d7f41c 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -144,7 +144,9 @@ static int afc_client_copy_and_remove_crash_reports(afc_client_t afc, const char
char* p = strrchr(list[k], '.');
if (p != NULL && !strncmp(p, ".synced", 7)) {
/* make sure to strip ".synced" extension as seen on iOS 5 */
- strncpy(((char*)target_filename) + host_directory_length, list[k], strlen(list[k]) - 7);
+ int newlen = strlen(list[k]) - 7;
+ strncpy(((char*)target_filename) + host_directory_length, list[k], newlen);
+ target_filename[host_directory_length + newlen] = '\0';
} else {
strcpy(((char*)target_filename) + host_directory_length, list[k]);
}