|
|
7e72be |
From bff38efe8c110469c5080d387bec62a6ca15b1a5 Mon Sep 17 00:00:00 2001
|
|
|
7e72be |
From: obiwac <obiwac@gmail.com>
|
|
|
7e72be |
Date: Fri, 22 Jul 2022 22:41:10 +0200
|
|
|
7e72be |
Subject: [PATCH] libarchive: Handle a `calloc` returning NULL (fixes #1754)
|
|
|
7e72be |
|
|
|
7e72be |
---
|
|
|
7e72be |
libarchive/archive_write.c | 8 ++++++++
|
|
|
7e72be |
1 file changed, 8 insertions(+)
|
|
|
7e72be |
|
|
|
7e72be |
diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c
|
|
|
7e72be |
index 66592e82..27626b54 100644
|
|
|
7e72be |
--- a/libarchive/archive_write.c
|
|
|
7e72be |
+++ b/libarchive/archive_write.c
|
|
|
7e72be |
@@ -201,6 +201,10 @@ __archive_write_allocate_filter(struct archive *_a)
|
|
|
7e72be |
struct archive_write_filter *f;
|
|
|
7e72be |
|
|
|
7e72be |
f = calloc(1, sizeof(*f));
|
|
|
7e72be |
+
|
|
|
7e72be |
+ if (f == NULL)
|
|
|
7e72be |
+ return (NULL);
|
|
|
7e72be |
+
|
|
|
7e72be |
f->archive = _a;
|
|
|
7e72be |
f->state = ARCHIVE_WRITE_FILTER_STATE_NEW;
|
|
|
7e72be |
if (a->filter_first == NULL)
|
|
|
7e72be |
@@ -548,6 +552,10 @@ archive_write_open2(struct archive *_a, void *client_data,
|
|
|
7e72be |
a->client_data = client_data;
|
|
|
7e72be |
|
|
|
7e72be |
client_filter = __archive_write_allocate_filter(_a);
|
|
|
7e72be |
+
|
|
|
7e72be |
+ if (client_filter == NULL)
|
|
|
7e72be |
+ return (ARCHIVE_FATAL);
|
|
|
7e72be |
+
|
|
|
7e72be |
client_filter->open = archive_write_client_open;
|
|
|
7e72be |
client_filter->write = archive_write_client_write;
|
|
|
7e72be |
client_filter->close = archive_write_client_close;
|
|
|
7e72be |
--
|
|
|
7e72be |
2.37.3
|
|
|
7e72be |
|