rpm/backport-Fix-possible-NULL-pointer-dereference-in-rpmfcClassi.patch

40 lines
1011 B
Diff
Raw Normal View History

2022-08-11 11:48:24 +08:00
From 1c15d748d3536a21b6edbbf9254db76fefb4b275 Mon Sep 17 00:00:00 2001
From: Dmitry Gerasimov <d.gerasimov@omp.ru>
Date: Mon, 27 Dec 2021 12:27:57 +0300
Subject: [PATCH] Fix possible NULL pointer dereference in rpmfcClassify
Here is simplified overview of possible dereference:
if (fc == NULL) {
rpmlog(RPMLOG_ERR, _("Empty file classifier\n"));
goto exit;
}
// ...
exit:
rpmstrPoolFreeze(fc->cdict, 0);
~~~~~~~~~
This issue was found by Svace Static Analyzer.
---
build/rpmfc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index eb51a36..cf2c203 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1168,7 +1168,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
if (fc == NULL) {
rpmlog(RPMLOG_ERR, _("Empty file classifier\n"));
- goto exit;
+ return RPMRC_FAIL;
}
/* It is OK when we have no files to classify. */
--
1.8.3.1