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

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