From: Richard Levitte Date: Tue, 7 Mar 2023 14:18:18 +0000 (+0100) Subject: bss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size() X-Git-Tag: openssl-3.2.0-alpha1~1192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8681703d48d062c2fc1736179218063275f8e33;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20449) --- diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index a2e90f6bd5c..b42e87b107a 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;