summaryrefslogtreecommitdiffstats
path: root/archive_reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'archive_reader.cc')
-rw-r--r--archive_reader.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/archive_reader.cc b/archive_reader.cc
index 8ad315d..5adcd08 100644
--- a/archive_reader.cc
+++ b/archive_reader.cc
@@ -1,5 +1,5 @@
/* Tarlz - Archiver with multimember lzip compression
- Copyright (C) 2013-2022 Antonio Diaz Diaz.
+ Copyright (C) 2013-2023 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -90,7 +90,7 @@ int Archive_reader_base::parse_records( Extended & extended,
const long long edsize = parse_octal( header + size_o, size_l );
const long long bufsize = round_up( edsize );
if( edsize <= 0 ) return err( 2, misrec_msg ); // no extended records
- if( edsize >= 1LL << 33 || bufsize >= INT_MAX )
+ if( edsize >= 1LL << 33 || bufsize > max_edata_size )
return err( -2, longrec_msg ); // records too long
if( !rbuf.resize( bufsize ) ) return err( -1, mem_msg );
e_msg_ = ""; e_code_ = 0;
@@ -116,10 +116,10 @@ int Archive_reader::read( uint8_t * const buf, const int size )
const int rd = readblock( ad.infd, buf, size );
if( rd != size && errno ) return err( -1, rdaerr_msg, errno, rd );
const Lzip_header & header = (*(const Lzip_header *)buf);
- const bool islz = ( rd >= min_member_size && header.verify_magic() &&
- header.verify_version() &&
+ const bool islz = ( rd >= min_member_size && header.check_magic() &&
+ header.check_version() &&
isvalid_ds( header.dictionary_size() ) );
- const bool istar = ( rd == size && verify_ustar_chksum( buf ) );
+ const bool istar = ( rd == size && check_ustar_chksum( buf ) );
const bool iseoa =
( !islz && !istar && rd == size && block_is_zero( buf, size ) );
bool maybe_lz = islz; // maybe corrupt tar.lz
@@ -139,7 +139,7 @@ int Archive_reader::read( uint8_t * const buf, const int size )
{ LZ_decompress_close( decoder ); decoder = 0; return err( -1, mem_msg ); }
xLZ_decompress_write( decoder, buf, rd );
const int ret = read( buf, size ); if( ret != 0 ) return ret;
- if( verify_ustar_chksum( buf ) || block_is_zero( buf, size ) ) return 0;
+ if( check_ustar_chksum( buf ) || block_is_zero( buf, size ) ) return 0;
return err( 2, islz ? posix_lz_msg : "" );
}