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
This commit is contained in:
parent
d477a9ed82
commit
4a8ceeebff
1 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ static int _tcp_bind(int sock, const struct sockaddr *address,
|
||||||
struct sockaddr_in *sinp;
|
struct sockaddr_in *sinp;
|
||||||
|
|
||||||
sinp= (struct sockaddr_in *)address;
|
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
|
#if DEBUG
|
||||||
fprintf(stderr, "bind(tcp): sin_family = %d, len = %d\n",
|
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;
|
struct sockaddr_in *sinp;
|
||||||
|
|
||||||
sinp= (struct sockaddr_in *)address;
|
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
|
#if DEBUG
|
||||||
fprintf(stderr, "bind(udp): sin_family = %d, len = %d\n",
|
fprintf(stderr, "bind(udp): sin_family = %d, len = %d\n",
|
||||||
|
|
Loading…
Reference in a new issue