Commit 68816550da for openssl.org

commit 68816550da2f6702d8c7145cf6039d0234d228e1
Author: Alexandr Nedvedicky <sashan@openssl.org>
Date:   Wed Nov 18 11:31:04 2026 +0100

    crypto/bio/bio_addr.c: memcpy() the provided address in BIO_ADDR_rawmake()

    There is no alignment expectations imposed on the address provided
    to BIO_ADDR_rawmake();  however, internally, IPv4 addresses are stored
    as struct in_addr, that is comprised of single in_addr_t, which,
    in turn, is a typedef to a 32-bit integer, and a simple cast
    and assignment may lead to UB, which was observed as a SIGBUS on sparc64
    in quic_memfail_test.c due to broken alignment expectations, where
    the address is supplied as a character string.  Use memcpy instead
    (and for IPv6 addresses as well, for good measure).

    Resolves: https://github.com/openssl/openssl/issues/33731
    Fixes: 28a0841bf58e "Refactoring BIO: add wrappers around sockaddr et al"
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Andrew Dinh <andrewd@openssl.org>
    Reviewed-by: Bob Beck <beck@openssl.org>
    Merge-date: Fri Nov 20 08:20:08 2026
    Merged-from: https://github.com/openssl/openssl/pull/33824

diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c
index 0d58285790..44c0a49432 100644
--- a/crypto/bio/bio_addr.c
+++ b/crypto/bio/bio_addr.c
@@ -150,7 +150,7 @@ int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
         memset(&ap->s_in, 0, sizeof(ap->s_in));
         ap->s_in.sin_family = family;
         ap->s_in.sin_port = port;
-        ap->s_in.sin_addr = *(struct in_addr *)where;
+        memcpy(&ap->s_in.sin_addr, where, sizeof(struct in_addr));
         return 1;
     }
 #if OPENSSL_USE_IPV6
@@ -160,7 +160,7 @@ int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
         memset(&ap->s_in6, 0, sizeof(ap->s_in6));
         ap->s_in6.sin6_family = family;
         ap->s_in6.sin6_port = port;
-        ap->s_in6.sin6_addr = *(struct in6_addr *)where;
+        memcpy(&ap->s_in6.sin6_addr, where, sizeof(struct in6_addr));
         return 1;
     }
 #endif