arrfab / rpms / libreport

Forked from rpms/libreport 5 years ago
Clone

Blame SOURCES/0011-coverity-Check-if-pointer-isnt-null-before-strcmp-de.patch

91b162
From 397ab29a84eeb73acf5bbaa5202b0b73c4de05db Mon Sep 17 00:00:00 2001
91b162
From: Martin Kutlak <mkutlak@redhat.com>
91b162
Date: Mon, 20 Aug 2018 15:52:03 +0200
91b162
Subject: [PATCH] coverity: Check if pointer isnt null before strcmp #def40
91b162
91b162
Passing NULL pointer to strcmp results in undefined behavior.
91b162
91b162
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
91b162
---
91b162
 src/plugins/mantisbt.c | 2 +-
91b162
 1 file changed, 1 insertion(+), 1 deletion(-)
91b162
91b162
diff --git a/src/plugins/mantisbt.c b/src/plugins/mantisbt.c
91b162
index f2542afd..1750dc5d 100644
91b162
--- a/src/plugins/mantisbt.c
91b162
+++ b/src/plugins/mantisbt.c
91b162
@@ -1042,7 +1042,7 @@ mantisbt_get_issue_info(const mantisbt_settings_t *settings, int issue_id)
91b162
     issue_info->mii_dup_id = response_get_id_of_relatedto_issue(result->mr_body);
91b162
 
91b162
     if (strcmp(issue_info->mii_status, "closed") == 0
91b162
-        && strcmp(issue_info->mii_resolution, "duplicate") == 0
91b162
+        && (issue_info->mii_resolution != NULL && strcmp(issue_info->mii_resolution, "duplicate") == 0)
91b162
         && issue_info->mii_dup_id == -1 )
91b162
     {
91b162
         error_msg(_("Issue %i is CLOSED as DUPLICATE, but it has no DUPLICATE_ID"),
91b162
-- 
91b162
2.17.1
91b162