Summary: | netbsd too-short cmsg struct | ||
---|---|---|---|
Product: | dbus | Reporter: | Havoc Pennington <hp> |
Component: | core | Assignee: | Havoc Pennington <hp> |
Status: | RESOLVED DUPLICATE | QA Contact: | John (J5) Palmieri <johnp> |
Severity: | normal | ||
Priority: | high | CC: | Glenn.Schmottlach, walters |
Version: | 1.2.x | ||
Hardware: | x86 (IA32) | ||
OS: | Windows (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Havoc Pennington
2006-11-17 13:57:48 UTC
I stumbled across this same bug in dbus/dbus-sysdeps-unix.c while porting DBus 1.2.4 to QNX where only LOCAL_CREDS are supported for domain sockets. In particular, in the function dbus_read_credentials_socket() (@ line ~1218) the code tries to verify that the size of the received credentials structure is the expected size. Unfortunately, for LOCAL_CREDS, this is computed incorrectly: BEFORE: ======= #if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS) if ( cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS ) For LOCAL_CREDS, this should actually be computed as follows: AFTER: ====== #if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS) #if defined(HAVE_CMSGCRED) if ( cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS ) #else if ( (cmsg.hdr.cmsg_len < (sizeof(cmsg.hdr) + SOCKCREDSIZE(0))) || (cmsg.hdr.cmsg_type != SCM_CREDS) ) #endif Running the dbus-daemon as root that has no (zero) supplemental groups, a simple sizeof(cmsg) is not correct since the sc_groups[1] field of struct sockcred will NOT be transmitted. Thankfully, the SOCKCREDSIZE macro in sockets.h computes the correct size (assuming that at a minimum, no supplemental groups are encoded in the stream). |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.