From: Ben Gras Date: Fri, 5 Aug 2011 20:55:57 +0000 (+0000) Subject: allow bind() with addr len >= sizeof(sockaddr_in) X-Git-Tag: v3.2.0~381 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/soc.html?a=commitdiff_plain;h=4a8ceeebffed242227e4ffded3ff5fb24aaf6b7c;p=minix.git allow bind() with addr len >= sizeof(sockaddr_in) . specifically, if it's struct sockaddr, which is 1 byte larger than sockaddr_in . unbreaks some applications . debugged and solved by Jan Wieck --- diff --git a/lib/nbsd_libc/sys-minix/bind.c b/lib/nbsd_libc/sys-minix/bind.c index b8ceb8984..666164af1 100644 --- a/lib/nbsd_libc/sys-minix/bind.c +++ b/lib/nbsd_libc/sys-minix/bind.c @@ -93,7 +93,7 @@ static int _tcp_bind(int sock, const struct sockaddr *address, struct sockaddr_in *sinp; sinp= (struct sockaddr_in *)address; - if (sinp->sin_family != AF_INET || address_len != sizeof(*sinp)) + if (sinp->sin_family != AF_INET || address_len < sizeof(*sinp)) { #if DEBUG fprintf(stderr, "bind(tcp): sin_family = %d, len = %d\n", @@ -133,7 +133,7 @@ static int _udp_bind(int sock, const struct sockaddr *address, struct sockaddr_in *sinp; sinp= (struct sockaddr_in *)address; - if (sinp->sin_family != AF_INET || address_len != sizeof(*sinp)) + if (sinp->sin_family != AF_INET || address_len < sizeof(*sinp)) { #if DEBUG fprintf(stderr, "bind(udp): sin_family = %d, len = %d\n",