Skip to content

Commit 260ddbb

Browse files
committed
Bump libarchive-clib to 3.8.6
1 parent eed2387 commit 260ddbb

19 files changed

Lines changed: 199 additions & 53 deletions

libarchive-clib/c/archive.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
3535
*/
3636
/* Note: Compiler will complain if this does not match archive_entry.h! */
37-
#define ARCHIVE_VERSION_NUMBER 3008005
37+
#define ARCHIVE_VERSION_NUMBER 3008006
3838

3939
#include <sys/stat.h>
4040
#include <stddef.h> /* for wchar_t */
@@ -177,7 +177,7 @@ __LA_DECL int archive_version_number(void);
177177
/*
178178
* Textual name/version of the library, useful for version displays.
179179
*/
180-
#define ARCHIVE_VERSION_ONLY_STRING "3.8.5"
180+
#define ARCHIVE_VERSION_ONLY_STRING "3.8.6"
181181
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
182182
__LA_DECL const char * archive_version_string(void);
183183

libarchive-clib/c/archive_acl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,12 @@ archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text,
12561256

12571257
tag = 0;
12581258
s = field[n].start;
1259-
st = field[n].start + 1;
12601259
len = field[n].end - field[n].start;
1260+
if (len == 0) {
1261+
ret = ARCHIVE_WARN;
1262+
continue;
1263+
}
1264+
st = s + 1;
12611265

12621266
switch (*s) {
12631267
case L'u':

libarchive-clib/c/archive_cryptor_private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ typedef struct {
109109
#include <nettle/version.h>
110110
#define ARCHIVE_CRYPTOR_USE_NETTLE 1
111111

112+
#ifndef AES_MAX_KEY_SIZE
113+
#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
114+
#endif
115+
112116
typedef struct {
113117
#if NETTLE_VERSION_MAJOR < 3
114118
struct aes_ctx ctx;

libarchive-clib/c/archive_entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define ARCHIVE_ENTRY_H_INCLUDED
2929

3030
/* Note: Compiler will complain if this does not match archive.h! */
31-
#define ARCHIVE_VERSION_NUMBER 3008005
31+
#define ARCHIVE_VERSION_NUMBER 3008006
3232

3333
/*
3434
* Note: archive_entry.h is for use outside of libarchive; the

libarchive-clib/c/archive_hmac.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ static void __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
198198
}
199199

200200
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
201+
#include <nettle/version.h>
201202

202203
static int
203204
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
@@ -216,7 +217,12 @@ __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
216217
static void
217218
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
218219
{
220+
#if NETTLE_VERSION_MAJOR < 4
219221
hmac_sha1_digest(ctx, (unsigned)*out_len, out);
222+
#else
223+
hmac_sha1_digest(ctx, out);
224+
*out_len = SHA1_DIGEST_SIZE;
225+
#endif
220226
}
221227

222228
static void

libarchive-clib/c/archive_read_open_filename.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,14 @@ archive_read_open_filenames(struct archive *a, const char **filenames,
122122
archive_clear_error(a);
123123
do
124124
{
125+
size_t len;
125126
if (filename == NULL)
126127
filename = "";
127-
mine = calloc(1,
128-
sizeof(*mine) + strlen(filename));
128+
len = strlen(filename);
129+
mine = calloc(1, sizeof(*mine) + len);
129130
if (mine == NULL)
130131
goto no_memory;
131-
strcpy(mine->filename.m, filename);
132+
memcpy(mine->filename.m, filename, len + 1);
132133
mine->block_size = block_size;
133134
mine->fd = -1;
134135
mine->buffer = NULL;

libarchive-clib/c/archive_read_support_filter_program.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ archive_read_support_filter_program_signature(struct archive *_a,
149149
if (signature != NULL && signature_len > 0) {
150150
state->signature_len = signature_len;
151151
state->signature = malloc(signature_len);
152+
if (state->signature == NULL)
153+
goto memerr;
152154
memcpy(state->signature, signature, signature_len);
153155
}
154156

libarchive-clib/c/archive_read_support_format_7zip.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#ifdef HAVE_STDLIB_H
3535
#include <stdlib.h>
3636
#endif
37+
#ifdef HAVE_LIMITS_H
38+
#include <limits.h>
39+
#endif
3740
#ifdef HAVE_BZLIB_H
3841
#include <bzlib.h>
3942
#endif
@@ -80,7 +83,7 @@
8083
/*
8184
* ELF format
8285
*/
83-
#define ELF_HDR_MIN_LEN 0x3f
86+
#define ELF_HDR_MIN_LEN 0x40 /* sizeof(Elf64_Ehdr) */
8487
#define ELF_HDR_EI_CLASS_OFFSET 0x04
8588
#define ELF_HDR_EI_DATA_OFFSET 0x05
8689

@@ -855,13 +858,18 @@ find_elf_data_sec(struct archive_read *a)
855858
while (e_shnum > 0) {
856859
name_offset = (*dec32)(h + sec_tbl_offset);
857860
if (name_offset == data_sym_offset) {
861+
uint64_t sel_offset;
862+
858863
if (format_64) {
859-
min_addr = (*dec64)(
864+
sel_offset = (*dec64)(
860865
h + sec_tbl_offset + 0x18);
861866
} else {
862-
min_addr = (*dec32)(
867+
sel_offset = (*dec32)(
863868
h + sec_tbl_offset + 0x10);
864869
}
870+
if (sel_offset > SSIZE_MAX)
871+
break;
872+
min_addr = (ssize_t)sel_offset;
865873
break;
866874
}
867875
sec_tbl_offset += e_shentsize;

libarchive-clib/c/archive_read_support_format_cab.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,10 @@ archive_read_support_format_cab(struct archive *_a)
383383
NULL,
384384
NULL);
385385

386-
if (r != ARCHIVE_OK)
386+
if (r != ARCHIVE_OK) {
387+
archive_wstring_free(&cab->ws);
387388
free(cab);
389+
}
388390
return (ARCHIVE_OK);
389391
}
390392

libarchive-clib/c/archive_read_support_format_lha.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,13 @@ lha_read_file_header_3(struct archive_read *a, struct lha *lha)
11011101
header_crc = lha_crc16(0, p, H3_FIXED_SIZE);
11021102
__archive_read_consume(a, H3_FIXED_SIZE);
11031103

1104+
/* Reject rediculously large header */
1105+
if (lha->header_size > 65536) {
1106+
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1107+
"LHa header size too large");
1108+
return (ARCHIVE_FATAL);
1109+
}
1110+
11041111
/* Read extended headers */
11051112
err = lha_read_file_extended_header(a, lha, &header_crc, 4,
11061113
lha->header_size - H3_FIXED_SIZE, &extdsize);

0 commit comments

Comments
 (0)