summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2017-08-04 23:34:25 +0000
committermm <mm@FreeBSD.org>2017-08-04 23:34:25 +0000
commit0eaab5f174a3c197b023b83b8911c7ed5189fc67 (patch)
tree8c53df52dfd97822d87033d58b5354cbfd8ebadb
parent6bec222914c5ecdb296e21dd27fda5354e2f706e (diff)
downloadFreeBSD-src-0eaab5f174a3c197b023b83b8911c7ed5189fc67.zip
FreeBSD-src-0eaab5f174a3c197b023b83b8911c7ed5189fc67.tar.gz
MFH r321674:
Sync libarchive with vendor. Relevant vendor changes: PR #926: ensure ar strtab is null terminated PR: 220462
-rw-r--r--contrib/libarchive/libarchive/archive_cryptor_private.h2
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_ar.c5
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 0ca544b..b975922 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 4fb2a59..cbd02fa 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;
}
OpenPOWER on IntegriCloud