diff options
author | Richard Levitte <levitte@openssl.org> | 2023-03-07 15:18:18 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2023-03-07 15:24:54 +0100 |
commit | a8681703d48d062c2fc1736179218063275f8e33 (patch) | |
tree | e7f23d7275414c98a6a6f32406586f69a3b63293 /crypto | |
parent | ac57336cd258e0432ffa485615d11c7c7ecfe81a (diff) |
bss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size()
Especially, it's important to use BIO_ADDR_sockaddr_size() instead of
taking sizeof(addr), as BIO_ADDR is a union of several sockaddr variants
with different sizes, and some sendto() implementations are very picky
that the size is correct for the indicated sockaddr family.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20449)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bss_dgram.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index a2e90f6bd5..b42e87b107 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -1423,8 +1423,8 @@ static int dgram_sendmmsg(BIO *b, BIO_MSG *msg, size_t stride, msg[0].data_len, # endif sysflags, - msg[0].peer != NULL ? &msg[0].peer->sa : NULL, - msg[0].peer != NULL ? sizeof(*msg[0].peer) : 0); + msg[0].peer != NULL ? BIO_ADDR_sockaddr(msg[0].peer) : NULL, + msg[0].peer != NULL ? BIO_ADDR_sockaddr_size(msg[0].peer) : 0); if (ret <= 0) { ERR_raise(ERR_LIB_SYS, get_last_socket_error()); *num_processed = 0; |