File bsc#1131353-bsc#1131356-0007-Med-controld-fix-possible-NULL-pointer-dereference-1.1.patch of Package pacemaker.13283

From 9dc38d81cb6e1967c368faed78de1927cabf06b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Wed, 17 Apr 2019 15:17:50 +0200
Subject: [PATCH 7/7] Med: controld: fix possible NULL pointer dereference

This is now more likely triggerable once the problems related to
CVE-2018-16878 are avoided.
---
 crmd/control.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

Index: pacemaker-1.1.18+20180430.b12c320f5/crmd/control.c
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/crmd/control.c
+++ pacemaker-1.1.18+20180430.b12c320f5/crmd/control.c
@@ -1,19 +1,10 @@
 /*
- * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
+ * Copyright 2004-2019 the Pacemaker project contributors
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * The version control history for this file may have further details.
  *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * This source code is licensed under the GNU General Public License version 2
+ * or later (GPLv2+) WITHOUT ANY WARRANTY.
  */
 
 #include <crm_internal.h>
@@ -96,12 +87,15 @@ do_ha_control(long long action,
             registered = crm_connect_corosync(cluster);
 #endif
         }
-        fsa_election = election_init(NULL, cluster->uname, 60000/*60s*/, election_timeout_popped);
-        fsa_our_uname = cluster->uname;
-        fsa_our_uuid = cluster->uuid;
-        if(cluster->uuid == NULL) {
-            crm_err("Could not obtain local uuid");
-            registered = FALSE;
+
+        if (registered == TRUE) {
+            fsa_election = election_init(NULL, cluster->uname, 60000/*60s*/, election_timeout_popped);
+            fsa_our_uname = cluster->uname;
+            fsa_our_uuid = cluster->uuid;
+            if(cluster->uuid == NULL) {
+                crm_err("Could not obtain local uuid");
+                registered = FALSE;
+            }
         }
 
         if (registered == FALSE) {
openSUSE Build Service is sponsored by