]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
auth: fix a no-memory case
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 10 Jan 2022 20:02:02 +0000 (00:02 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 21 Jan 2022 12:05:09 +0000 (16:05 +0400)
Jumping to "out" will call _dbus_string_zero() unconditionally on tmp
string variables. Do not attempt to zero what wasn't even initialized.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
dbus/dbus-auth.c

index 62b5b13c7f3a342adc4388b3bd761350eea4ab8f..d4faa7376ca0c0269549d7e6a4d04502f586d7f4 100644 (file)
@@ -525,8 +525,8 @@ sha1_handle_first_client_response (DBusAuth         *auth,
   /* We haven't sent a challenge yet, we're expecting a desired
    * username from the client.
    */
-  DBusString tmp;
-  DBusString tmp2;
+  DBusString tmp = _DBUS_STRING_INIT_INVALID;
+  DBusString tmp2 = _DBUS_STRING_INIT_INVALID;
   dbus_bool_t retval = FALSE;
   DBusError error = DBUS_ERROR_INIT;
   DBusCredentials *myself = NULL;
@@ -557,7 +557,7 @@ sha1_handle_first_client_response (DBusAuth         *auth,
       if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
         {
           dbus_error_free (&error);
-          goto out;
+          return FALSE;
         }
 
       _dbus_verbose ("%s: Did not get a valid username from client: %s\n",