Skip to content

Commit c699087

Browse files
olszomalmtrojnar
authored andcommitted
Check the length of the attribute certificate entry
1 parent abbbfab commit c699087

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pe.c

+6
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ static int pe_check_file(FILE_FORMAT_CTX *ctx, int detached)
206206
*/
207207
while (sum < ctx->pe_ctx->siglen) {
208208
uint32_t len = GET_UINT32_LE(ctx->options->indata + ctx->pe_ctx->sigpos + sum);
209+
if (ctx->pe_ctx->siglen - len > 8) {
210+
printf("Corrupted attribute certificate table\n");
211+
printf("Attribute certificate table size : %08X\n", ctx->pe_ctx->siglen);
212+
printf("Attribute certificate entry length: %08X\n\n", len);
213+
return 0; /* FAILED */
214+
}
209215
/* quadword align data */
210216
len += len % 8 ? 8 - len % 8 : 0;
211217
sum += len;

0 commit comments

Comments
 (0)