blob: b2aeb0384e6e1699949a13143e7835a2f9315b4a (
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
|
From 8ec9cfc81c3f8326a1c7ee5b795ef517cd48e6b4 Mon Sep 17 00:00:00 2001
From: yuxiaojun <yuxiaojun1011@outlook.com>
Date: Wed, 14 Jun 2023 11:23:24 +0800
Subject: [PATCH] Fix possible null pointer reference in ndb
slot1 and slot2 may be NULL
Signed-off-by: yuxiaojun <yuxiaojun1011@outlook.com>
---
lib/backend/ndb/rpmxdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/backend/ndb/rpmxdb.c b/lib/backend/ndb/rpmxdb.c
index 2c1f29842..d9c373cb0 100644
--- a/lib/backend/ndb/rpmxdb.c
+++ b/lib/backend/ndb/rpmxdb.c
@@ -755,7 +755,7 @@ static int moveblobstofront(rpmxdb xdb, struct xdb_slot *afterslot)
if (slot2 == xdb->slots)
slot2 = 0;
}
- if (slot1->pagecnt < slot2->pagecnt) {
+ if (slot1 && slot2 && slot1->pagecnt < slot2->pagecnt) {
struct xdb_slot *tmp = slot1;
slot1 = slot2;
slot2 = tmp;
--
2.27.0
|