summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibarchive/libarchive/archive_options.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-24 14:31:22 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-02-24 14:31:22 (GMT)
commit33f636264a5d830f67316dc6184f4056b3a3629f (patch)
treee6ac48bd3f34f86be4bed7f0e520555a1550b458 /Utilities/cmlibarchive/libarchive/archive_options.c
parent8429068d7c37d06e53b871811760419ab3e36455 (diff)
parentd49176e91e4fb4ae31be1011c1029ca07d2cf494 (diff)
downloadCMake-33f636264a5d830f67316dc6184f4056b3a3629f.zip
CMake-33f636264a5d830f67316dc6184f4056b3a3629f.tar.gz
CMake-33f636264a5d830f67316dc6184f4056b3a3629f.tar.bz2
Merge topic 'update-libarchive'
d49176e9 libarchive: Avoid using isblank ce8f117f libarchive: Avoid declaration after statement in C code e0f725f8 libarchive: Fix use of ssize_t in archive_entry.h ae4861ec libarchive: Define __LA_DEPRECATED consistently fecb70dd Update CMake pre-cached values for libarchive 3.3.0 a59a7ee9 Merge branch 'upstream-LibArchive' into update-libarchive c206211a LibArchive 2017-02-19 (100ee75a) cdce7c61 libarchive: Update script to get 3.3.0
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_options.c')
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_options.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_options.c b/Utilities/cmlibarchive/libarchive/archive_options.c
index dbf3e80..6496025 100644
--- a/Utilities/cmlibarchive/libarchive/archive_options.c
+++ b/Utilities/cmlibarchive/libarchive/archive_options.c
@@ -26,6 +26,10 @@
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#include "archive_options_private.h"
static const char *
@@ -105,8 +109,11 @@ _archive_set_options(struct archive *a, const char *options,
if (options == NULL || options[0] == '\0')
return ARCHIVE_OK;
- data = (char *)malloc(strlen(options) + 1);
- strcpy(data, options);
+ if ((data = strdup(options)) == NULL) {
+ archive_set_error(a,
+ ENOMEM, "Out of memory adding file to list");
+ return (ARCHIVE_FATAL);
+ }
s = (const char *)data;
do {