summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2015-04-21 13:16:53 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2015-07-13 14:33:32 +0200
commitd10ac7c57e91435c2eca5817dae51a91ff708f78 (patch)
tree08b75e6ec46d7829b705c52e6639d2474b3c07b6
parent907c0b36e9fff225aa5a43b0be13f709bc4b9534 (diff)
downloaddbus-d10ac7c57e91435c2eca5817dae51a91ff708f78.tar.gz
bus_registry_new: Assert in case of not valid context parameter to avoid potiental crashes (CID 54764).
Because the context parameter is dereferenced several times in related code without a null check, we need to make sure to have a valid context. Reported by Coverity: CID 54764: Dereference after null check (FORWARD_NULL) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r--bus/services.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bus/services.c b/bus/services.c
index 8e625867..6a4c8848 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -76,6 +76,7 @@ bus_registry_new (BusContext *context)
{
BusRegistry *registry;
+ _dbus_assert (context);
registry = dbus_new0 (BusRegistry, 1);
if (registry == NULL)
return NULL;
@@ -461,8 +462,7 @@ bus_registry_acquire_service (BusRegistry *registry,
}
if (!bus_apparmor_allows_acquire_service (connection,
- (registry->context ?
- bus_context_get_type (registry->context) : NULL),
+ bus_context_get_type (registry->context),
_dbus_string_get_const_data (service_name), error))
goto out;