--- src/sys/kern/uipc_syscalls.c 2007/01/08 21:41:56 1.77 +++ src/sys/kern/uipc_syscalls.c 2007/01/29 14:16:42 1.77.2.1 @@ -970,8 +970,12 @@ sys_recvmsg(struct recvmsg_args *uap) * Conditionally copyout the name and populate the namelen field. */ if (error == 0 && msg.msg_name) { - fromlen = MIN(msg.msg_namelen, sa->sa_len); - error = copyout(sa, msg.msg_name, fromlen); + /* note: sa may still be NULL */ + if (sa != NULL) { + fromlen = MIN(msg.msg_namelen, sa->sa_len); + error = copyout(sa, msg.msg_name, fromlen); + } else + fromlen = 0; if (error == 0) error = copyout(&fromlen, ufromlenp, sizeof(*ufromlenp));