Fix undefined behaviour in fastcgi.c (#14269)

Arithmetic on NULL pointers is undefined.
This commit is contained in:
Niels Dossche 2024-05-19 22:54:06 +02:00 committed by GitHub
parent a59868aef8
commit ad5138a341
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -744,7 +744,7 @@ int fcgi_listen(const char *path, int backlog)
memset(&sa.sa_unix, 0, sizeof(sa.sa_unix));
sa.sa_unix.sun_family = AF_UNIX;
memcpy(sa.sa_unix.sun_path, path, path_len + 1);
sock_len = (size_t)(((struct sockaddr_un *)0)->sun_path) + path_len;
sock_len = XtOffsetOf(struct sockaddr_un, sun_path) + path_len;
#ifdef HAVE_SOCKADDR_UN_SUN_LEN
sa.sa_unix.sun_len = sock_len;
#endif