summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-23 15:29:33 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-23 15:29:33 +0100
commita2c3e19e589a291315e1aced47272a0a7024fd06 (patch)
tree2c1dce0b77d790257104628adf182d6841834b77 /src/file_txt.c
parentee055322f600a963f2ffa72485f8956022720c51 (diff)
PhotoRec: reduce false positive when detecting .bat
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index 377dbd0..48358da 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -807,8 +807,7 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
return 1;
}
}
- if(strncasecmp((const char *)buffer, "@echo off", 9)==0 ||
- strncasecmp((const char *)buffer, "rem ", 4)==0)
+ if(strncasecmp((const char *)buffer, "@echo off", 9)==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->data_check=&data_check_txt;
@@ -905,6 +904,15 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
l=UTF2Lat((unsigned char*)buffer_lower, buffer, buffer_size_test);
if(l<10)
return 0;
+ if(strncasecmp((const char *)buffer, "rem ", 4)==0)
+ {
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->data_check=&data_check_txt;
+ file_recovery_new->file_check=&file_check_size;
+ /* Dos/Windows bath */
+ file_recovery_new->extension="bat";
+ return 1;
+ }
{
const char *ext=NULL;
/* ind=~0: random