]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-sysdeps-unix: Check socklen_t is unsigned when getting group list
authorcptpcrd <cptpcrd.git@gmail.com>
Mon, 31 Jul 2023 23:33:33 +0000 (19:33 -0400)
committerSimon McVittie <smcv@collabora.com>
Wed, 16 Aug 2023 10:29:50 +0000 (11:29 +0100)
After the change to handle an empty list properly, the function now
assumes that is true.

(cherry picked from commit 49dd4aba42280c438b1207963f7071bfd7707775)

dbus/dbus-sysdeps-unix.c

index 2ce425d07dbeed8193a4c72d3e865cf84e9ca0b2..099637cb6e1fc10a00c4d27b37d8427015378082 100644 (file)
@@ -1932,6 +1932,8 @@ add_groups_to_credentials (int              client_fd,
 {
 #if defined(__linux__) && defined(SO_PEERGROUPS)
   _DBUS_STATIC_ASSERT (sizeof (gid_t) <= sizeof (dbus_gid_t));
+  /* This function assumes socklen_t is unsigned, which is true on Linux */
+  _DBUS_STATIC_ASSERT (((socklen_t) -1) > 0);
   gid_t *buf = NULL;
   socklen_t len = 1024;
   dbus_bool_t oom = FALSE;