diff options
author | Martin Matuska <mm@FreeBSD.org> | 2017-07-28 23:56:07 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2017-07-28 23:56:07 +0000 |
commit | a758cabb3fac437949ede792668e281870429798 (patch) | |
tree | 9b97e926a0bb91f40a9d2fb1df2f5f2bf2efa084 /contrib/libarchive | |
parent | f8d0488ec61829504cf6784dcff2bad0921558a0 (diff) | |
parent | b85c4c3da0a560cb98d13902c308e54fdeb52d70 (diff) | |
download | src-test2-a758cabb3fac437949ede792668e281870429798.tar.gz src-test2-a758cabb3fac437949ede792668e281870429798.zip |
MFV r321673:
Sync libarchive with vendor.
Relevant vendor changes:
PR #926: ensure ar strtab is null terminated
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=321674
Diffstat (limited to 'contrib/libarchive')
-rw-r--r-- | contrib/libarchive/libarchive/archive_cryptor_private.h | 2 | ||||
-rw-r--r-- | contrib/libarchive/libarchive/archive_write_set_format_ar.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/contrib/libarchive/libarchive/archive_cryptor_private.h b/contrib/libarchive/libarchive/archive_cryptor_private.h index 0ca544b57971..b9759220df69 100644 --- a/contrib/libarchive/libarchive/archive_cryptor_private.h +++ b/contrib/libarchive/libarchive/archive_cryptor_private.h @@ -64,7 +64,7 @@ typedef struct { } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) -#include <Bcrypt.h> +#include <bcrypt.h> /* Common in other bcrypt implementations, but missing from VS2008. */ #ifndef BCRYPT_SUCCESS diff --git a/contrib/libarchive/libarchive/archive_write_set_format_ar.c b/contrib/libarchive/libarchive/archive_write_set_format_ar.c index 4fb2a5995ae7..cbd02fafa3f0 100644 --- a/contrib/libarchive/libarchive/archive_write_set_format_ar.c +++ b/contrib/libarchive/libarchive/archive_write_set_format_ar.c @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const void *buff, size_t s) return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s); + ar->strtab = (char *)malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); return (ARCHIVE_FATAL); } - strncpy(ar->strtab, buff, s); + memcpy(ar->strtab, buff, s); + ar->strtab[s] = '\0'; ar->has_strtab = 1; } |