Bug#276138: sys/un.h: SUN_LEN cannot be used in abstract namespace
Package: libc6-dev
Version: 2.3.2.ds1-17
Severity: minor
File: /usr/include/sys/un.h
The man-page unix(7) describes abstract namespace as follows.
sun_family always contains AF_UNIX. sun_path contains the zero-termi-
nated pathname of the socket in the file system. If sun_path starts
with a zero byte it refers to the abstract namespace maintained by the
Unix protocol module. The socket's address in this namespace is given
by the rest of the bytes in sun_path. Note that names in the abstract
namespace are not zero-terminated.
The macro SUN_LEN currently is defined as
#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path))
I suggest that a check should be made for a zero first byte, and in that
case return sizeof(struct sockaddr_un), as the manpage says.
If it is the programmers responsibility to check for abstract
namespace, I suggest adding a comment about that close to the
definition of SUN_LEN.
Thanks!
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.8.1
Locale: LANG=sv_SE, LC_CTYPE=sv_SE
Versions of packages libc6-dev depends on:
ii libc6 2.3.2.ds1-17 GNU C Library: Shared libraries an
ii linux-kernel-headers 2.5.999-test7-bk-17 Linux Kernel Headers for developme
-- no debconf information
Reply to: