[Cmake-commits] CMake branch, next, updated. v3.2.1-1681-ga319109

Brad King brad.king at kitware.com
Thu Apr 9 14:16:28 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  a319109ff49ce318236f3954bae79339689e27bf (commit)
       via  1f33b45d5daca380e0be0ecfc595eac881328f29 (commit)
      from  9c4af87283f734060777856febe72d2dc1a187dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a319109ff49ce318236f3954bae79339689e27bf
commit a319109ff49ce318236f3954bae79339689e27bf
Merge: 9c4af87 1f33b45
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 9 14:16:27 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Apr 9 14:16:27 2015 -0400

    Merge topic 'fix-libarchive-mktemp' into next
    
    1f33b45d libarchive: Fix string concatentation in Windows mktemp implementation


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f33b45d5daca380e0be0ecfc595eac881328f29
commit 1f33b45d5daca380e0be0ecfc595eac881328f29
Author:     Tim Kientzle <kientzle at gmail.com>
AuthorDate: Thu Sep 25 18:51:57 2014 -0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 9 14:08:43 2015 -0400

    libarchive: Fix string concatentation in Windows mktemp implementation
    
    Port upstream LibArchive commit "compute string pointers after
    concatenation" (2014-09-25) and commit "Move variables to top of
    function for non-C99 compilers" (2014-11-15) to our CMake copy.
    Otherwise we may compute a pointer to memory that is about to be freed
    and then compute a bad size to give to CryptGenRandom.
    
    Inspired-by: Tim Kientzle <kientzle at gmail.com>

diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c
index 96b88d8..d136498 100644
--- a/Utilities/cmlibarchive/libarchive/archive_util.c
+++ b/Utilities/cmlibarchive/libarchive/archive_util.c
@@ -249,6 +249,8 @@ __archive_errx(int retvalue, const char *msg)
 int
 __archive_mktemp(const char *tmpdir)
 {
+	static const wchar_t *prefix = L"libarchive_";
+	static const wchar_t *suffix = L"XXXXXXXXXX";
 	static const wchar_t num[] = {
 		L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',
 		L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F',
@@ -323,10 +325,10 @@ __archive_mktemp(const char *tmpdir)
 	/*
 	 * Create a temporary file.
 	 */
-	archive_wstrcat(&temp_name, L"libarchive_");
-	xp = temp_name.s + archive_strlen(&temp_name);
-	archive_wstrcat(&temp_name, L"XXXXXXXXXX");
+	archive_wstrcat(&temp_name, prefix);
+	archive_wstrcat(&temp_name, suffix);
 	ep = temp_name.s + archive_strlen(&temp_name);
+	xp = ep - wcslen(suffix);
 
 	if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
 		CRYPT_VERIFYCONTEXT)) {

-----------------------------------------------------------------------

Summary of changes:
 Utilities/cmlibarchive/libarchive/archive_util.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list