summaryrefslogtreecommitdiffstats
path: root/src/file_fob.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-08-09 09:44:39 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-08-09 09:44:39 +0200
commitf719dd169330ed5a977ae371a6338425d85d6167 (patch)
treef2623279877518d2aa1cf52250dfd47f42c17d91 /src/file_fob.c
parent19e6b941e2d34fa6585e4695d7380d40b72f1c4c (diff)
PhotoRec: define a minimal size for .fob
Diffstat (limited to 'src/file_fob.c')
-rw-r--r--src/file_fob.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/file_fob.c b/src/file_fob.c
index 7ddaa93..fbe172b 100644
--- a/src/file_fob.c
+++ b/src/file_fob.c
@@ -48,12 +48,18 @@ static int header_check_fob(const unsigned char *buffer, const unsigned int buff
{
static const unsigned char sign_navnl[5] = {'N','A','V','N','L'};
static const unsigned char sign_navw[4] = {'N','A','V','W'};
- if(td_memmem(buffer, buffer_size, sign_navnl, sizeof(sign_navnl))==NULL &&
- td_memmem(buffer, buffer_size, sign_navw, sizeof(sign_navw))==NULL)
+ unsigned int tmp=0;
+ const unsigned char *pos1=(const unsigned char *)td_memmem(buffer, buffer_size, sign_navnl, sizeof(sign_navnl));
+ const unsigned char *pos2=(const unsigned char *)td_memmem(buffer, buffer_size, sign_navw, sizeof(sign_navw));
+ if(pos1==NULL && pos2==NULL)
return 0;
+ if(pos1!=NULL)
+ tmp=pos1-buffer;
+ if(pos2!=NULL && pos2-buffer > tmp)
+ tmp=pos2-buffer;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_fob.extension;
- file_recovery_new->min_filesize=10;
+ file_recovery_new->min_filesize=tmp;
return 1;
}