summaryrefslogtreecommitdiffstats
path: root/src/file_ext.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-08-28 08:29:32 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-08-28 08:29:32 +0200
commitda8028ea3fb282cee6fd54f4ac8c8a53dacfa967 (patch)
treed52e4641fd338d51423cd1bc9f38e120d3e60ad6 /src/file_ext.c
parented174946a0dd7c01650e43edec55d56a3373284a (diff)
TestDisk: handle ext4 with 64 bit blocks (EXT4_FEATURE_INCOMPAT_64BIT)
Diffstat (limited to 'src/file_ext.c')
-rw-r--r--src/file_ext.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/file_ext.c b/src/file_ext.c
index 5ce48a3..dd7eb1b 100644
--- a/src/file_ext.c
+++ b/src/file_ext.c
@@ -30,6 +30,7 @@
#include "types.h"
#include "common.h"
#include "ext2.h"
+#include "ext2_common.h"
#include "filegen.h"
static void register_header_check_ext2_sb(file_stat_t *file_stat);
@@ -66,22 +67,7 @@ static void file_rename_ext(const char *old_filename)
static int header_check_ext2_sb(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
const struct ext2_super_block *sb=(const struct ext2_super_block *)buffer;
- if(le16(sb->s_magic)!=EXT2_SUPER_MAGIC)
- return 0;
- if (le32(sb->s_free_blocks_count) >= le32(sb->s_blocks_count))
- return 0;
- if (le32(sb->s_free_inodes_count) >= le32(sb->s_inodes_count))
- return 0;
- if (le16(sb->s_errors)!=0 &&
- (le16(sb->s_errors) != EXT2_ERRORS_CONTINUE) &&
- (le16(sb->s_errors) != EXT2_ERRORS_RO) &&
- (le16(sb->s_errors) != EXT2_ERRORS_PANIC))
- return 0;
- if ((le16(sb->s_state) & ~(EXT2_VALID_FS | EXT2_ERROR_FS))!=0)
- return 0;
- if (le32(sb->s_blocks_count) == 0) /* reject empty filesystem */
- return 0;
- if(le32(sb->s_log_block_size)>2) /* block size max = 4096, can be 8192 on alpha */
+ if(test_EXT2(sb, NULL)!=0)
return 0;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_ext2_sb.extension;