summaryrefslogtreecommitdiff
path: root/backport-Fix-possible-NULL-pointer-dereference-in-rpmfcClassi.patch
blob: cb718a4a6a89c93df88343934f44e4faad15f3e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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