dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 25ccb26a6c58cf7284e900588bf68ce6eec21b4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Thu, 16 Aug 2018 12:57:47 +0200
Subject: [PATCH 33/47] sbus: check for null message in sbus_message_bound

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit 30f4adf874aff174734ad77902a79fc5727ab495)
---
 src/sbus/request/sbus_message.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/sbus/request/sbus_message.c b/src/sbus/request/sbus_message.c
index 950be9122610f3394d982173a3616f9d9fac23d9..7314fd724dd3daec520ba0d1fdd2974995446e8c 100644
--- a/src/sbus/request/sbus_message.c
+++ b/src/sbus/request/sbus_message.c
@@ -83,6 +83,11 @@ sbus_message_bound(TALLOC_CTX *mem_ctx, DBusMessage *msg)
         return EINVAL;
     }
 
+    if (msg == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Message can not be NULL!\n");
+        return EINVAL;
+    }
+
     /* Create a talloc context that will unreference this message when
      * the parent context is freed. */
     talloc_msg = talloc(mem_ctx, struct sbus_talloc_msg);
@@ -122,6 +127,11 @@ sbus_message_bound(TALLOC_CTX *mem_ctx, DBusMessage *msg)
 errno_t
 sbus_message_bound_ref(TALLOC_CTX *mem_ctx, DBusMessage *msg)
 {
+    if (msg == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Message can not be NULL!\n");
+        return EINVAL;
+    }
+
     dbus_message_ref(msg);
     return sbus_message_bound(mem_ctx, msg);
 }
-- 
2.14.4