Date: Tue, 3 Nov 2015 00:46:07 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290318 - head/lib/libc/net Message-ID: <201511030046.tA30k7Ti024842@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Tue Nov 3 00:46:06 2015 New Revision: 290318 URL: https://svnweb.freebsd.org/changeset/base/290318 Log: sdl->sdl_len in sockaddr_dl can be longer than sizeof(struct sockaddr_dl). Modified: head/lib/libc/net/getnameinfo.c Modified: head/lib/libc/net/getnameinfo.c ============================================================================== --- head/lib/libc/net/getnameinfo.c Tue Nov 3 00:21:23 2015 (r290317) +++ head/lib/libc/net/getnameinfo.c Tue Nov 3 00:46:06 2015 (r290318) @@ -122,7 +122,8 @@ getnameinfo(const struct sockaddr *sa, s afd = find_afd(sa->sa_family); if (afd == NULL) return (EAI_FAMILY); - if (sa->sa_family == PF_LOCAL) { + switch (sa->sa_family) { + case PF_LOCAL: /* * PF_LOCAL uses variable sa->sa_len depending on the * content length of sun_path. Require 1 byte in @@ -132,8 +133,17 @@ getnameinfo(const struct sockaddr *sa, s salen <= afd->a_socklen - sizeofmember(struct sockaddr_un, sun_path)) return (EAI_FAIL); - } else if (salen != afd->a_socklen) - return (EAI_FAIL); + break; + case PF_LINK: + if (salen <= afd->a_socklen - + sizeofmember(struct sockaddr_dl, sdl_data)) + return (EAI_FAIL); + break; + default: + if (salen != afd->a_socklen) + return (EAI_FAIL); + break; + } return ((*afd->a_func)(afd, sa, salen, host, hostlen, serv, servlen, flags));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511030046.tA30k7Ti024842>