From 4a8ceeebffed242227e4ffded3ff5fb24aaf6b7c Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 5 Aug 2011 20:55:57 +0000 Subject: [PATCH] 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 --- lib/nbsd_libc/sys-minix/bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", -- 2.44.0