summaryrefslogtreecommitdiffstats
path: root/src/file_abr.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-09-12 13:16:15 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-09-12 13:16:15 +0200
commitb75c2fca2a39cea956efff127c345c00e99486f0 (patch)
treede23d458cffe11c9568621c64b4815291fe3f0ba /src/file_abr.c
parent65543b032a3f3978f46add944c050d30e2d1a400 (diff)
PhotoRec: avoid potential endless loops
Diffstat (limited to 'src/file_abr.c')
-rw-r--r--src/file_abr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file_abr.c b/src/file_abr.c
index e95f299..a21d4bf 100644
--- a/src/file_abr.c
+++ b/src/file_abr.c
@@ -57,7 +57,7 @@ static data_check_t data_check_abr(const unsigned char *buffer, const unsigned i
const struct abr_header *hdr=(const struct abr_header*)&buffer[i];
if(memcmp(hdr->magic, "8BIM", 4)!=0)
return DC_STOP;
- file_recovery->calculated_file_size+=be32(hdr->size)+12;
+ file_recovery->calculated_file_size+=(uint64_t)12 + be32(hdr->size);
}
return DC_CONTINUE;
}
@@ -71,7 +71,7 @@ static int header_check_abr(const unsigned char *buffer, const unsigned int buff
const struct abr_header *h=(const struct abr_header*)&buffer[i];
if(memcmp(h->magic, "8BIM", 4)!=0)
return 0;
- i+=be32(h->size)+12;
+ i+=(uint64_t)12 + be32(h->size);
}
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_abr.extension;