summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2010-01-07 10:44:21 +0000
committerAndy Polyakov <appro@openssl.org>2010-01-07 10:44:21 +0000
commita32f7fb8322bae7c1748a4bf6520c97aefaa197e (patch)
tree6b84bb7db31a6ae1f0d56e52237e6cd68e312c92 /crypto/bio
parent496cf69e4049664934573af6102aa062d9aad068 (diff)
sendto is reportedly picky about destination socket address length [from HEAD].
PR: 2114 Submitted by: Robin Seggelmann
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bss_dgram.c14
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)