diff options
author | Brad King <brad.king@kitware.com> | 2015-04-10 12:31:01 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-10 12:31:01 (GMT) |
commit | 8b4c40155a4f7cf7e1f93b792a3e1e9678d284d7 (patch) | |
tree | 974118554dcd60c6ffd1ddc80964930b0aa87ff3 /Utilities/cmlibarchive | |
parent | 4411d1d779345f54c132209834daa49763cd1999 (diff) | |
parent | 1f33b45d5daca380e0be0ecfc595eac881328f29 (diff) | |
download | CMake-8b4c40155a4f7cf7e1f93b792a3e1e9678d284d7.zip CMake-8b4c40155a4f7cf7e1f93b792a3e1e9678d284d7.tar.gz CMake-8b4c40155a4f7cf7e1f93b792a3e1e9678d284d7.tar.bz2 |
Merge topic 'fix-libarchive-mktemp'
1f33b45d libarchive: Fix string concatentation in Windows mktemp implementation
Diffstat (limited to 'Utilities/cmlibarchive')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_util.c | 8 |
1 files changed, 5 insertions, 3 deletions
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)) { |