Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fail with negative lha->compsize in lha_read_file_header_1()
Fixes a heap buffer overflow reported in Secunia SA74169
  • Loading branch information
mmatuska committed Jan 19, 2017
1 parent 42f7080 commit 98dcbbf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libarchive/archive_read_support_format_lha.c
Expand Up @@ -924,6 +924,9 @@ lha_read_file_header_1(struct archive_read *a, struct lha *lha)
/* Get a real compressed file size. */
lha->compsize -= extdsize - 2;

if (lha->compsize < 0)
goto invalid; /* Invalid compressed file size */

if (sum_calculated != headersum) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"LHa header sum error");
Expand Down

1 comment on commit 98dcbbf

@carnil
Copy link

@carnil carnil commented on 98dcbbf Jan 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is CVE-2017-5601

Please sign in to comment.