projects
/
platform
/
upstream
/
libarchive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 3.3.0
[platform/upstream/libarchive.git]
/
libarchive
/
archive_options.c
diff --git
a/libarchive/archive_options.c
b/libarchive/archive_options.c
index
dbf3e80
..
6496025
100644
(file)
--- a/
libarchive/archive_options.c
+++ b/
libarchive/archive_options.c
@@
-26,6
+26,10
@@
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#include "archive_options_private.h"
static const char *
#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;
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 {
s = (const char *)data;
do {