hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()
[platform/upstream/dbus.git] / dbus / dbus-keyring.c
index 3b9ce31..2516bc3 100644 (file)
@@ -718,6 +718,12 @@ _dbus_keyring_new_for_credentials (DBusCredentials  *credentials,
   
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
 
+  if (_dbus_getenv ("HOME") == NULL)
+    {
+      dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+                            "Unable to create DBus keyring with no $HOME");
+      return FALSE;
+    }
   if (_dbus_check_setuid ())
     {
       dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,