1
0
mirror of https://github.com/wolfSSL/wolfssl.git synced 2026-10-24 04:09:07 +03:00
Files
wolfssl/examples/benchmark
Tobias Frauenschläger cbbe108ee8 Copy the resolved address pointer out of an unaligned hostent
On macOS, gethostbyname() returns a struct hostent whose h_addr_list array is
not aligned for a pointer, so reading h_addr_list[0] as a char * is undefined
behavior. Under -fsanitize=undefined with -fno-sanitize-recover, as in the
ubsan-mldsa-mlkem pq-all row, build_addr() in wolfssl/test.h aborts the first
test that resolves localhost, and unit.test fails. The TLS benchmark client
does the same load. glibc aligns the array, so Linux CI does not see it.

The library does the same in its gethostbyname() fallbacks, which a build
without HAVE_GETADDRINFO uses: wolfIO_TcpConnect() and the OCSP responder
screening in wolfIO_OcspDestAllowed(). Configured that way on macOS, both
abort under UBSan.

Copy the pointer out with XMEMCPY before using it in all four places. A plain
assignment would be the same misaligned load; memcpy reads the bytes without
an alignment requirement.
2026-09-28 17:39:34 +02:00
..
2026-02-18 09:52:21 -07:00