summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2018-04-29 19:03:30 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2018-04-29 19:03:30 +0200
commit3348b9932ab4e61c0321d0e88db54f0e803b5103 (patch)
treec7cbaab6977bc530a568f5bf2f12289bd2ca373e
parent26566702534823806492008da908a5db207843b4 (diff)
PhotoRec: Change recovered filename to handle more than 2^32 sectors.
See https://github.com/cgsecurity/testdisk/issues/47
-rw-r--r--configure.ac2
-rw-r--r--src/dirn.c2
-rw-r--r--src/file_fits.c2
-rw-r--r--src/photorec.c8
-rw-r--r--src/types.h6
5 files changed, 10 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 88984bb..ee216ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([testdisk],[7.1-WIP],[grenier@cgsecurity.org])
AC_LANG(C)
sinclude(acx_pthread.m4)
sinclude(mkdir.m4)
-TESTDISKDATE="March 2018"
+TESTDISKDATE="April 2018"
AC_SUBST(TESTDISKDATE)
AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release])
AC_CONFIG_AUX_DIR(config)
diff --git a/src/dirn.c b/src/dirn.c
index dbf4fa3..ab18db9 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -49,6 +49,7 @@ static int copy_dir(WINDOW *window, disk_t *disk, const partition_t *partition,
static int copy_selection(file_info_t*dir_list, WINDOW *window, disk_t *disk, const partition_t *partition, dir_data_t *dir_data, unsigned int *copy_ok, unsigned int *copy_bad);
#define INTER_DIR (LINES-25+15)
+#define MAX_DIR_NBR 256
static int copy_progress(WINDOW *window, const unsigned int copy_ok, const unsigned int copy_bad)
{
@@ -577,7 +578,6 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
static int dir_partition_aux(disk_t *disk, const partition_t *partition, dir_data_t *dir_data, const unsigned long int inode, const unsigned int depth, char**current_cmd)
{
-#define MAX_DIR_NBR 256
static unsigned long int inode_known[MAX_DIR_NBR];
if(depth==MAX_DIR_NBR)
return 1; /* subdirectories depth is too high => Back */
diff --git a/src/file_fits.c b/src/file_fits.c
index 606772f..12065ec 100644
--- a/src/file_fits.c
+++ b/src/file_fits.c
@@ -116,7 +116,7 @@ static data_check_t data_check_fits(const unsigned char *buffer, const unsigned
{
unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
if(memcmp(&buffer[i], "XTENSION", 8)!=0)
- break;
+ break;
{
const unsigned int i_org=i;
const uint64_t tmp=fits_info(buffer, buffer_size, file_recovery, &i);
diff --git a/src/photorec.c b/src/photorec.c
index 0273a39..d8b0da1 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -706,16 +706,16 @@ void set_filename(file_recovery_t *file_recovery, struct ph_param *params)
if(file_recovery->extension==NULL || file_recovery->extension[0]=='\0')
{
snprintf(file_recovery->filename,sizeof(file_recovery->filename)-1,
- "%s.%u/%c%07u", params->recup_dir,
+ "%s.%u/%c%07lu", params->recup_dir,
params->dir_num, (broken?'b':'f'),
- (unsigned int)((file_recovery->location.start - params->partition->part_offset)/ params->disk->sector_size));
+ (unsigned long int)((file_recovery->location.start - params->partition->part_offset)/ params->disk->sector_size));
}
else
{
snprintf(file_recovery->filename,sizeof(file_recovery->filename)-1,
- "%s.%u/%c%07u.%s", params->recup_dir,
+ "%s.%u/%c%07lu.%s", params->recup_dir,
params->dir_num, (broken?'b':'f'),
- (unsigned int)((file_recovery->location.start - params->partition->part_offset) / params->disk->sector_size), file_recovery->extension);
+ (unsigned long int)((file_recovery->location.start - params->partition->part_offset) / params->disk->sector_size), file_recovery->extension);
}
}
diff --git a/src/types.h b/src/types.h
index 48932d6..22b53e0 100644
--- a/src/types.h
+++ b/src/types.h
@@ -24,9 +24,9 @@
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
- #ifdef HAVE_STDINT_H
- #include <stdint.h>
- #endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>