Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2017 23:34:25 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r322071 - stable/11/contrib/libarchive/libarchive
Message-ID:  <201708042334.v74NYPgK095331@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Fri Aug  4 23:34:25 2017
New Revision: 322071
URL: https://svnweb.freebsd.org/changeset/base/322071

Log:
  MFH r321674:
  Sync libarchive with vendor.
  
  Relevant vendor changes:
    PR #926: ensure ar strtab is null terminated
  
  PR:	220462

Modified:
  stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h
  stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h
==============================================================================
--- stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h	Fri Aug  4 23:04:24 2017	(r322070)
+++ stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h	Fri Aug  4 23:34:25 2017	(r322071)
@@ -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: stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c
==============================================================================
--- stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c	Fri Aug  4 23:04:24 2017	(r322070)
+++ stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c	Fri Aug  4 23:34:25 2017	(r322071)
@@ -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?201708042334.v74NYPgK095331>