#include <kern/task.h>
#include <sys/priv.h>
#include <sys/sysctl.h>
+#include <sys/sys_domain.h>
#include <security/audit/audit.h>
goto out;
AUDIT_ARG(sockaddr, vfs_context_cwd(vfs_context_current()), sa);
#if CONFIG_MACF_SOCKET_SUBSET
- if ((error = mac_socket_check_bind(kauth_cred_get(), so, sa)) == 0)
+ if ((sa != NULL && sa->sa_family == AF_SYSTEM) ||
+ (error = mac_socket_check_bind(kauth_cred_get(), so, sa)) == 0)
error = sobindlock(so, sa, 1); /* will lock socket */
#else
error = sobindlock(so, sa, 1); /* will lock socket */
* different size for 32 bits and 64 bits processes
*/
if (cp->cmsg_level == SOL_SOCKET && cp->cmsg_type == SCM_TIMESTAMP) {
- unsigned char tmp_buffer[CMSG_SPACE(sizeof(struct user64_timeval))];
+ unsigned char tmp_buffer[CMSG_SPACE(sizeof(struct user64_timeval))] = {};
struct cmsghdr *tmp_cp = (struct cmsghdr *)(void *)tmp_buffer;
int tmp_space;
struct timeval *tv = (struct timeval *)(void *)CMSG_DATA(cp);