]> git.ipfire.org Git - thirdparty/glibc.git/commit
Don’t include string.h from sys/un.h.
authorZack Weinberg <zackw@panix.com>
Wed, 22 May 2019 16:03:57 +0000 (12:03 -0400)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 18:45:45 +0000 (13:45 -0500)
commit225a0f4ef94a6505f2bb28d44d85bb3a9a45e5ef
treee01f8c8f3fc2fd914e37a6a9741f14e94c1ea597
parent39906a3e2c0811b6097ec53cbe7b4d9f2321315e
Don’t include string.h from sys/un.h.

sys/un.h needs strlen in order to define SUN_LEN, but does not need
any of the other things declared by string.h; the path of least
resistance is to prototype strlen locally.

Also, the construct being used to get the size of everything up to the
sun_path member contains a formal dereference of a null pointer and
therefore has undefined behavior.  Replace with __SOCKADDR_COMMON_SIZE.

Some old RPC code was relying on sys/un.h to provide all of string.h.

* sys/un.h [__USE_MISC]: Don’t include string.h.
Include bits/types/size_t.h.  Prototype strlen locally.
Use __SOCKADDR_COMMON_SIZE for size of leading members of
struct sockaddr_un.

* nis/nis_domain_of.c, nis/yp_xdr.c, sunrpc/svc.c:
Include string.h.

* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
nis/nis_domain_of.c
nis/yp_xdr.c
scripts/check-obsolete-constructs.py
socket/sys/un.h
sunrpc/svc.c