arrfab / rpms / libreport

Forked from rpms/libreport 5 years ago
Clone

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

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