]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
auth: Clear GUID from server if out of memory
authorSimon McVittie <smcv@collabora.com>
Sat, 29 Jun 2019 16:00:02 +0000 (17:00 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 2 Jul 2019 19:45:31 +0000 (20:45 +0100)
If we retry processing the message in response to OOM, but we don't
clear this buffer first, then the assertion at the beginning will fail.

Signed-off-by: Simon McVittie <smcv@collabora.com>
dbus/dbus-auth.c

index 9e8b2bc090b183943ef1bde801b835b4d7e538ef..62b5b13c7f3a342adc4388b3bd761350eea4ab8f 100644 (file)
@@ -1664,10 +1664,25 @@ process_ok(DBusAuth *auth,
                  _dbus_string_get_const_data (& DBUS_AUTH_CLIENT (auth)->guid_from_server));
 
   if (auth->unix_fd_possible)
-    return send_negotiate_unix_fd(auth);
+    {
+      if (!send_negotiate_unix_fd (auth))
+        {
+          _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0);
+          return FALSE;
+        }
+
+      return TRUE;
+    }
 
   _dbus_verbose("Not negotiating unix fd passing, since not possible\n");
-  return send_begin (auth);
+
+  if (!send_begin (auth))
+    {
+      _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0);
+      return FALSE;
+    }
+
+  return TRUE;
 }
 
 static dbus_bool_t