summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-05-25 12:41:42 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-05-25 12:41:42 +0200
commitcf15e5dcd2f75edef2f1ddb382ec08b628a7823f (patch)
tree09f0c0e78ca40ff4a88603139b4e81a89da1d0ee /src/file_txt.c
parent1ec19820a50546298c1685593aac63f68a5c22ec (diff)
PhotoRec: fix regression (crash) in header_check_txt
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index 73851d9..85ea044 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -821,7 +821,7 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
{
static char *buffer_lower=NULL;
static unsigned int buffer_lower_size=0;
- unsigned int l=0;
+ unsigned int l;
const unsigned int buffer_size_test=(buffer_size < 2048 ? buffer_size : 2048);
{
unsigned int i;
@@ -882,7 +882,7 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
}
if(buffer[0]=='#' && buffer[1]=='!')
{
- unsigned int ll=l-2;
+ unsigned int ll=512-2;
const unsigned char *haystack=(const unsigned char *)buffer+2;
const unsigned char *res;
res=(const unsigned char *)memchr(haystack,'\n',ll);