aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2017-07-28 23:51:08 +0000
committerMartin Matuska <mm@FreeBSD.org>2017-07-28 23:51:08 +0000
commitb85c4c3da0a560cb98d13902c308e54fdeb52d70 (patch)
treeaacbcf71a2d0280f9cd8f8f97e8974a695287f59
parenta732671a5f4bd00eea035709a769772002307c0e (diff)
downloadsrc-b85c4c3da0a560cb98d13902c308e54fdeb52d70.tar.gz
src-b85c4c3da0a560cb98d13902c308e54fdeb52d70.zip
Update vendor/libarchive to git de20494ba2a4fcff8b56010faa75467ad8d5a40b
Relevant vendor changes: PR #926: ensure ar strtab is null terminated
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=321673
-rw-r--r--libarchive/archive_cryptor_private.h2
-rw-r--r--libarchive/archive_write_set_format_ar.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h
index 0ca544b57971..b9759220df69 100644
--- a/libarchive/archive_cryptor_private.h
+++ b/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/libarchive/archive_write_set_format_ar.c b/libarchive/archive_write_set_format_ar.c
index c9771d81a128..441119d5d714 100644
--- a/libarchive/archive_write_set_format_ar.c
+++ b/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;
}