diff options
author | kientzle <kientzle@FreeBSD.org> | 2007-07-15 19:13:59 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2007-07-15 19:13:59 +0000 |
commit | c2571d8b749d2251abc1a93a11f2cf9c5b3d9cef (patch) | |
tree | 277b7c303ff4bb3a5583547383d51d714527e1c8 /lib/libarchive/archive_read_support_format_zip.c | |
parent | 235eaa1de0144fe4b74f0955091911fb67fffa86 (diff) | |
download | FreeBSD-src-c2571d8b749d2251abc1a93a11f2cf9c5b3d9cef.zip FreeBSD-src-c2571d8b749d2251abc1a93a11f2cf9c5b3d9cef.tar.gz |
archive_string_ensure() used to call exit(3) if it
couldn't allocate more memory for a string. Change
this so it returns NULL in that case, and update
all of its callers to handle the error. Some of
those callers can now return errors back to the
client instead of calling exit(3).
Approved by: re (bmah)
Diffstat (limited to 'lib/libarchive/archive_read_support_format_zip.c')
-rw-r--r-- | lib/libarchive/archive_read_support_format_zip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libarchive/archive_read_support_format_zip.c b/lib/libarchive/archive_read_support_format_zip.c index a3e8573..80507bb 100644 --- a/lib/libarchive/archive_read_support_format_zip.c +++ b/lib/libarchive/archive_read_support_format_zip.c @@ -302,7 +302,8 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry, "Truncated ZIP file header"); return (ARCHIVE_FATAL); } - archive_string_ensure(&zip->pathname, zip->filename_length); + if (archive_string_ensure(&zip->pathname, zip->filename_length) == NULL) + __archive_errx(1, "Out of memory"); archive_strncpy(&zip->pathname, (const char *)h, zip->filename_length); (a->decompressor->consume)(a, zip->filename_length); archive_entry_set_pathname(entry, zip->pathname.s); |