summaryrefslogtreecommitdiffstats
path: root/src/file_dbf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-11-01 11:14:14 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-11-01 11:14:14 +0100
commit6166156b477041b85cb2bbb7ed264893cd8694ac (patch)
treeed5343badab5b5f2558bf3fa1b1f7a8266fdc8b2 /src/file_dbf.c
parent3718ffa3328b530ad61bba2007842716201b89a2 (diff)
PhotoRec: stricter check for .dbf files
Diffstat (limited to 'src/file_dbf.c')
-rw-r--r--src/file_dbf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/file_dbf.c b/src/file_dbf.c
index ce6362a..821a3bf 100644
--- a/src/file_dbf.c
+++ b/src/file_dbf.c
@@ -52,8 +52,14 @@ static void register_header_check_dbf(file_stat_t *file_stat)
static int header_check_dbf(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)
{
- /* 0x03 YY MM DD */
- if(buffer[0]==0x3 && (buffer[1]>80 || buffer[1]<20) && (buffer[2]>=1 && buffer[2]<=12) && (buffer[3]>=1 && buffer[3]<=31))
+ /* 0x03 YY MM DD reserved=0 */
+ if(buffer[0]==0x3 && (buffer[1]>80 || buffer[1]<120) &&
+ (buffer[2]>=1 && buffer[2]<=12) && (buffer[3]>=1 && buffer[3]<=31) &&
+ buffer[12]==0 && buffer[13]==0 && buffer[14]==0 && buffer[15]==0 &&
+ buffer[16]==0 && buffer[17]==0 && buffer[18]==0 && buffer[19]==0 &&
+ buffer[20]==0 && buffer[21]==0 && buffer[22]==0 && buffer[23]==0 &&
+ buffer[24]==0 && buffer[25]==0 && buffer[26]==0 && buffer[27]==0 &&
+ buffer[30]==0 && buffer[31]==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_dbf.extension;