Skip to content

Commit

Permalink
Fix: buffer overflow (CVE-2018-11724)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfabiszewski committed Jun 20, 2018
1 parent c625698 commit b5657d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,12 @@ static MOBI_RET mobi_decompress_content(const MOBIData *m, char *text, FILE *fil
}
}
const size_t decrypt_size = curr->size - extra_size;
if (decrypt_size > decompressed_size) {
debug_print("Record too large: %zu\n", decrypt_size);
mobi_free_huffcdic(huffcdic);
free(decompressed);
return MOBI_DATA_CORRUPT;
}
if (decrypt_size) {
ret = mobi_drm_decrypt_buffer(decompressed, curr->data, decrypt_size, m);
if (ret != MOBI_SUCCESS) {
Expand Down

0 comments on commit b5657d7

Please sign in to comment.