Skip to content

Commit fce2890

Browse files
authored
Merge pull request #202 from mentebinaria/i197
Remove exit() from libpe
2 parents 40e423c + fdd5671 commit fce2890

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/libpe/hashes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "libpe/hashes.h"
2323

24+
#include "libpe/error.h"
2425
#include "libpe/pe.h"
2526
#include "libfuzzy/fuzzy.h"
2627
#include "libpe/ordlookup.h"
@@ -139,9 +140,6 @@ static pe_err_e get_headers_optional_hash(pe_ctx_t *ctx, pe_hash_t *output) {
139140
const IMAGE_OPTIONAL_HEADER *sample = pe_optional(ctx);
140141

141142
switch (sample->type) {
142-
default:
143-
// TODO(jweyrich): handle unknown type.
144-
exit(1);
145143
case MAGIC_ROM:
146144
{
147145
const unsigned char *data = (const unsigned char *)sample->_rom;
@@ -160,6 +158,8 @@ static pe_err_e get_headers_optional_hash(pe_ctx_t *ctx, pe_hash_t *output) {
160158
const uint64_t data_size = sizeof(IMAGE_OPTIONAL_HEADER_64);
161159
return get_hashes(output, "IMAGE_OPTIONAL_HEADER_64", data, data_size);
162160
}
161+
default:
162+
return LIBPE_E_UNSUPPORTED_IMAGE;
163163
}
164164
}
165165

0 commit comments

Comments
 (0)