Blame SOURCES/0005-Add-NULL-checks-before-string-compares-when-analyzin.patch

2c4167
From 0eec70b9dbd0a50a24fe173a68fd9ab72857e08d Mon Sep 17 00:00:00 2001
2c4167
From: Rob Crittenden <rcritten@redhat.com>
2c4167
Date: Wed, 17 Feb 2021 13:40:52 -0500
2c4167
Subject: [PATCH] Add NULL checks before string compares when analyzing a cert
2c4167
2c4167
A user reported a segfault which was due to a broken request.
2c4167
How it got broken I have no idea but it was effectively empty.
2c4167
2c4167
It had everything as defaults: 0, -1, UNSPECIFIED or not
2c4167
present at all.
2c4167
2c4167
So when trying to analyze the request it did a NULL compare.
2c4167
2c4167
https://pagure.io/certmonger/issue/191
2c4167
---
2c4167
 src/tdbush.c | 4 ++--
2c4167
 1 file changed, 2 insertions(+), 2 deletions(-)
2c4167
2c4167
diff --git a/src/tdbush.c b/src/tdbush.c
2c4167
index a10a1aff..fb81c477 100644
2c4167
--- a/src/tdbush.c
2c4167
+++ b/src/tdbush.c
2c4167
@@ -678,14 +678,14 @@ base_add_request(DBusConnection *conn, DBusMessage *msg,
2c4167
 		if (cert_storage != e->cm_cert_storage_type) {
2c4167
 			continue;
2c4167
 		}
2c4167
-		if (strcmp(cert_location, e->cm_cert_storage_location) != 0) {
2c4167
+		if ((e->cm_cert_storage_location == NULL) || strcmp(cert_location, e->cm_cert_storage_location) != 0) {
2c4167
 			continue;
2c4167
 		}
2c4167
 		switch (cert_storage) {
2c4167
 		case cm_cert_storage_file:
2c4167
 			break;
2c4167
 		case cm_cert_storage_nssdb:
2c4167
-			if (strcmp(cert_nickname, e->cm_cert_nickname) != 0) {
2c4167
+			if ((e->cm_cert_nickname == NULL) || strcmp(cert_nickname, e->cm_cert_nickname) != 0) {
2c4167
 				continue;
2c4167
 			}
2c4167
 			break;
2c4167
-- 
2c4167
2.31.1
2c4167