diff options
author | Andy Polyakov <appro@openssl.org> | 2010-01-07 10:42:39 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2010-01-07 10:42:39 +0000 |
commit | 9b5ca556956bb67b7b24dfb84efd099c0a7eed6c (patch) | |
tree | 9e207c91375956679ee8b421afa853193baf99a8 /crypto/bio | |
parent | cba9ffc32a68586ff00c1770df1a516bebf992d2 (diff) |
sendto is reportedly picky about destination socket address length.
PR: 2114
Submitted by: Robin Seggelmann
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bss_dgram.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index ef739fcf59..eb7e365467 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -335,11 +335,21 @@ static int dgram_write(BIO *b, const char *in, int inl) if ( data->connected ) ret=writesocket(b->num,in,inl); else + { + int peerlen = sizeof(data->peer); + + if (data->peer.sa.sa_family == AF_INET) + peerlen = sizeof(data->peer.sa_in); +#if OPENSSL_USE_IVP6 + else if (data->peer.sa.sa_family == AF_INET6) + peerlen = sizeof(data->peer.sa_in6); +#endif #if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK) - ret=sendto(b->num, (char *)in, inl, 0, &data->peer.sa, sizeof(data->peer)); + ret=sendto(b->num, (char *)in, inl, 0, &data->peer.sa, peerlen); #else - ret=sendto(b->num, in, inl, 0, &data->peer.sa, sizeof(data->peer)); + ret=sendto(b->num, in, inl, 0, &data->peer.sa, peerlen); #endif + } BIO_clear_retry_flags(b); if (ret <= 0) |