|
|
a3bee1 |
From 66cdd50832a99e175079bfb36a321fd9499c6f0e Mon Sep 17 00:00:00 2001
|
|
|
a3bee1 |
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
|
|
|
a3bee1 |
Date: Wed, 22 May 2019 18:06:28 +0200
|
|
|
a3bee1 |
Subject: [PATCH] import: Don't call unlink(NULL) in _import_extract()
|
|
|
a3bee1 |
MIME-Version: 1.0
|
|
|
a3bee1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a3bee1 |
Content-Transfer-Encoding: 8bit
|
|
|
a3bee1 |
|
|
|
a3bee1 |
Similarly to the issue fixed by ae52b0fbc, here we're also potentially
|
|
|
a3bee1 |
passing NULL to unlink().
|
|
|
a3bee1 |
|
|
|
a3bee1 |
Error: FORWARD_NULL (CWE-476):
|
|
|
a3bee1 |
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:332: var_compare_op: Comparing "source_file" to null implies that "source_file" might be null.
|
|
|
a3bee1 |
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:374: var_deref_model: Passing null pointer "source_file" to "unlink", which dereferences it.
|
|
|
a3bee1 |
# 372| g_object_unref(file);
|
|
|
a3bee1 |
# 373| if (!file_is_native)
|
|
|
a3bee1 |
# 374|-> unlink(source_file);
|
|
|
a3bee1 |
# 375| g_free(source_file);
|
|
|
a3bee1 |
# 376| return ret;
|
|
|
a3bee1 |
|
|
|
a3bee1 |
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
a3bee1 |
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
|
|
a3bee1 |
(cherry picked from commit 69eb33ad4207c76c0738bfa00b40c97892bab0ad)
|
|
|
a3bee1 |
---
|
|
|
a3bee1 |
tools/osinfo-db-import.c | 2 +-
|
|
|
a3bee1 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
a3bee1 |
|
|
|
a3bee1 |
diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
|
|
|
a3bee1 |
index 11e68ae..675961d 100644
|
|
|
a3bee1 |
--- a/tools/osinfo-db-import.c
|
|
|
a3bee1 |
+++ b/tools/osinfo-db-import.c
|
|
|
a3bee1 |
@@ -370,7 +370,7 @@ static int osinfo_db_import_extract(GFile *target,
|
|
|
a3bee1 |
archive_read_free(arc);
|
|
|
a3bee1 |
if (file)
|
|
|
a3bee1 |
g_object_unref(file);
|
|
|
a3bee1 |
- if (!file_is_native)
|
|
|
a3bee1 |
+ if (!file_is_native && source_file != NULL)
|
|
|
a3bee1 |
unlink(source_file);
|
|
|
a3bee1 |
g_free(source_file);
|
|
|
a3bee1 |
return ret;
|
|
|
a3bee1 |
--
|
|
|
a3bee1 |
2.21.0
|
|
|
a3bee1 |
|