mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
socket: Use offsetof in SUN_LEN (bug 29578)
Use offsetof instead of its traditional expansion in the definition of the SUN_LEN macro, to avoid a warning from the undefined behaviour sanitizer.
This commit is contained in:
parent
954b8f3895
commit
c15318bfc5
@ -34,10 +34,11 @@ struct sockaddr_un
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <stddef.h>
|
||||
# include <string.h> /* For prototype of `strlen'. */
|
||||
|
||||
/* Evaluate to actual length of the `sockaddr_un' structure. */
|
||||
# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
# define SUN_LEN(ptr) (offsetof (struct sockaddr_un, sun_path) \
|
||||
+ strlen ((ptr)->sun_path))
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user