summaryrefslogtreecommitdiffstats
path: root/src/file_tiff.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:11:03 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:11:03 +0200
commit31300161d196063d973f6c4368d990b11fa22ff9 (patch)
tree1ca97007f538017d69199ab926d51fda04dc91bf /src/file_tiff.c
parentc63960562842934ff3929b2d537ecd901027d5cb (diff)
PhotoRec: check fseek return value in tiff file validation
Diffstat (limited to 'src/file_tiff.c')
-rw-r--r--src/file_tiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/file_tiff.c b/src/file_tiff.c
index 45b5184..62efd5d 100644
--- a/src/file_tiff.c
+++ b/src/file_tiff.c
@@ -922,11 +922,11 @@ void file_check_tiff(file_recovery_t *fr)
unsigned char *buffer=(unsigned char *)MALLOC(8192);
int data_read;
calculated_file_size = 0;
- fseek(fr->handle, 0, SEEK_SET);
- data_read=fread(buffer, 1, sizeof(buffer), fr->handle);
- if(data_read < (int)sizeof(TIFFHeader))
+ if(fseek(fr->handle, 0, SEEK_SET) < 0 ||
+ (data_read=fread(buffer, 1, sizeof(buffer), fr->handle)) < (int)sizeof(TIFFHeader))
{
free(buffer);
+ fr->file_size=0;
return;
}
{