summaryrefslogtreecommitdiffstats
path: root/src/file_jpg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:09:28 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:09:28 +0200
commitfc97dd06e0fc04d61e53ec8d1003f91240ebe37d (patch)
tree3ad46b99f02a4c0c59d701c08f36d767105b336c /src/file_jpg.c
parent7e5749b013e101aa39052a7fcd89bdd7cf276ce6 (diff)
PhotoRec: check fseek return value in jpg file validation
Diffstat (limited to 'src/file_jpg.c')
-rw-r--r--src/file_jpg.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/file_jpg.c b/src/file_jpg.c
index 0c261e7..c695181 100644
--- a/src/file_jpg.c
+++ b/src/file_jpg.c
@@ -527,7 +527,8 @@ static inline int jpeg_session_resume(struct jpeg_session_struct *jpeg_session)
if(resume_memory((j_common_ptr)&jpeg_session->cinfo))
return -1;
src = (my_source_mgr *) jpeg_session->cinfo.src;
- fseek(jpeg_session->handle, jpeg_session->offset + src->file_size, SEEK_SET);
+ if(fseek(jpeg_session->handle, jpeg_session->offset + src->file_size, SEEK_SET) < 0)
+ return -1;
return 0;
}
@@ -1061,7 +1062,8 @@ static void jpg_search_marker(file_recovery_t *file_recovery)
return ;
offset=file_recovery->offset_error / file_recovery->blocksize * file_recovery->blocksize;
i=file_recovery->offset_error % file_recovery->blocksize;
- fseek(infile, offset, SEEK_SET);
+ if(fseek(infile, offset, SEEK_SET) < 0)
+ return ;
do
{
while((nbytes=fread(&buffer, 1, sizeof(buffer), infile))>0)
@@ -1102,7 +1104,8 @@ static uint64_t jpg_check_structure(file_recovery_t *file_recovery, const unsign
uint64_t thumb_offset=0;
int nbytes;
file_recovery->extra=0;
- fseek(infile, 0, SEEK_SET);
+ if(fseek(infile, 0, SEEK_SET) < 0)
+ return 0;
if((nbytes=fread(&buffer, 1, sizeof(buffer), infile))>0)
{
unsigned int offset;