Author: jkim Date: Thu Oct 6 21:09:28 2011 New Revision: 226073 URL: http://svn.freebsd.org/changeset/base/226073
Log: Make sure to ignore the leading NULL byte from Linux abstract namespace. Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Thu Oct 6 20:48:23 2011 (r226072) +++ head/sys/compat/linux/linux_socket.c Thu Oct 6 21:09:28 2011 (r226073) @@ -90,6 +90,7 @@ linux_getsockaddr(struct sockaddr **sap, int oldv6size; struct sockaddr_in6 *sin6; #endif + char *name; int alloclen, hdrlen, namelen; if (osalen < 2 || osalen > UCHAR_MAX || !osa) @@ -158,8 +159,15 @@ linux_getsockaddr(struct sockaddr **sap, if (bdom == AF_LOCAL && osalen > sizeof(struct sockaddr_un)) { hdrlen = offsetof(struct sockaddr_un, sun_path); - namelen = strnlen(((struct sockaddr_un *)kosa)->sun_path, - osalen - hdrlen); + name = ((struct sockaddr_un *)kosa)->sun_path; + if (*name == '\0') { + /* + * Linux abstract namespace starts with a NULL byte. + * XXX We do not support abstract namespace yet. + */ + namelen = strnlen(name + 1, osalen - hdrlen - 1) + 1; + } else + namelen = strnlen(name, osalen - hdrlen); if (hdrlen + namelen > sizeof(struct sockaddr_un)) { error = ENAMETOOLONG; goto out; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"