unix: fix out of bounds memory access in tests

sockaddrIUCVToAny used the wrong size to for copying to RawSockaddrAny.
We found this by running the test with ASAN.

Change-Id: I2a2ec28f9bd55aeba4ddcb4243ad61ec010087df
Reviewed-on: https://go-review.googlesource.com/c/sys/+/724280
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Florian Zenker
2025-11-25 07:35:26 -08:00
committed by Michael Stapelberg
parent 4f4f1c6fea
commit 08e54827f6
+1 -1
View File
@@ -909,7 +909,7 @@ func sockaddrIUCVToAny(in RawSockaddrIUCV) *RawSockaddrAny {
var out RawSockaddrAny
copy(
(*(*[SizeofSockaddrAny]byte)(unsafe.Pointer(&out)))[:],
(*(*[SizeofSockaddrUnix]byte)(unsafe.Pointer(&in)))[:],
(*(*[SizeofSockaddrIUCV]byte)(unsafe.Pointer(&in)))[:],
)
return &out
}