summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2020-09-14 18:37:51 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2020-09-14 18:37:51 +0200
commitf236b8cc4d3e4a7cd27105436e1faf970de87787 (patch)
treea7a4cfb13cc8dd0e7a89f220e3fd9b649de306f4
parenta60c71823e5bff4c42a5ae6b487cfa2672727cee (diff)
src/file_indd.c: fix warnings reported by frama-c
-rw-r--r--src/file_indd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/file_indd.c b/src/file_indd.c
index a5ea927..638a321 100644
--- a/src/file_indd.c
+++ b/src/file_indd.c
@@ -95,8 +95,17 @@ static void file_check_indd(file_recovery_t *file_recovery)
file_recovery->file_size=0;
return ;
}
- if(fread(&hdr, sizeof(hdr), 1, file_recovery->handle) != 1 ||
- memcmp(hdr.fGUID, kINDDContigObjHeaderGUID, sizeof(kINDDContigObjHeaderGUID))!=0)
+ if(fread(&hdr, sizeof(hdr), 1, file_recovery->handle) != 1)
+ {
+ file_recovery->file_size=(offset+4096-1)/4096*4096;
+ if(file_recovery->file_size>file_size_org)
+ file_recovery->file_size=0;
+ return ;
+ }
+#ifdef __FRAMAC__
+ Frama_C_make_unknown(&hdr, sizeof(hdr));
+#endif
+ if(memcmp(hdr.fGUID, kINDDContigObjHeaderGUID, sizeof(kINDDContigObjHeaderGUID))!=0)
{
file_recovery->file_size=(offset+4096-1)/4096*4096;
if(file_recovery->file_size>file_size_org)