explicitly check if these files open

This commit is contained in:
2020-02-19 17:14:01 -05:00
parent 29b4c63ffd
commit eb225122e5

View File

@@ -150,6 +150,12 @@ int stage3_function(struct pwned_device *dev)
checkm8_debug_indent("exploit stage 3\n");
FILE *overwrite_file = fopen(CHECKM8_BIN_BASE "overwrite.bin", "r");
if(overwrite_file == NULL)
{
checkm8_debug_indent("\tfailed to open overwrite file\n");
return CHECKM8_FAIL_NOINST;
}
fseek(overwrite_file, 0, SEEK_END);
ow_len = ftell(overwrite_file);
rewind(overwrite_file);
@@ -159,6 +165,12 @@ int stage3_function(struct pwned_device *dev)
fclose(overwrite_file);
FILE *payload_file = fopen(CHECKM8_BIN_BASE "payload.bin", "r");
if(payload_file == NULL)
{
checkm8_debug_indent("\tfailed to open payload file\n");
return CHECKM8_FAIL_NOINST;
}
fseek(payload_file, 0, SEEK_END);
pl_len = ftell(payload_file);
rewind(payload_file);