Date: Fri, 28 Jul 2017 23:56:08 +0000 (UTC) From: Martin Matuska <mm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321674 - head/contrib/libarchive/libarchive Message-ID: <201707282356.v6SNu89R042702@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mm Date: Fri Jul 28 23:56:07 2017 New Revision: 321674 URL: https://svnweb.freebsd.org/changeset/base/321674 Log: MFV r321673: Sync libarchive with vendor. Relevant vendor changes: PR #926: ensure ar strtab is null terminated MFC after: 1 week Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Jul 28 23:51:08 2017 (r321673) +++ head/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Jul 28 23:56:07 2017 (r321674) @@ -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 Modified: head/contrib/libarchive/libarchive/archive_write_set_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:51:08 2017 (r321673) +++ head/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Jul 28 23:56:07 2017 (r321674) @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707282356.v6SNu89R042702>