Skip to content

Commit 89db053

Browse files
committed
added a check if we could open the provided file
1 parent a734e69 commit 89db053

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ int main(int argc, char **argv) {
123123
// get the raw data of the file
124124
auto raw = get_raw_file(argv[1]);
125125

126+
// check if we have data
127+
if (!raw.size()) {
128+
std::cout << "Error: could not open file" << std::endl;
129+
130+
return -1;
131+
}
132+
126133
// elf signature for comparing to the raw data
127134
const std::array<uint8_t, 4> elf_signature = {0x7f, 'E', 'L', 'F'};
128135

0 commit comments

Comments
 (0)