summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-04-11 19:38:44 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-04-11 19:38:44 +0200
commitccb272200cf62909f57836993c55f111614119b6 (patch)
tree85b33b7dd11fd0b74463b2d1490605e1afcaa6b8 /src/file_txt.c
parent9d4eb87787fcbf78c91cde7a2902d1e0d1368e7e (diff)
PhotoRec: a text file must contains several lines
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index 909d430..6fbe36a 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -941,6 +941,18 @@ 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;
+ {
+ unsigned int line_nbr=0;
+ unsigned int i;
+ for(i=0; i<512 && i<l; i++)
+ {
+ if(buffer[i]=='\n')
+ line_nbr++;
+ }
+ /* A text file must contains several lines */
+ if(line_nbr==0)
+ return 0;
+ }
if(strncasecmp((const char *)buffer, "rem ", 4)==0)
{
reset_file_recovery(file_recovery_new);