Skip to content

Commit 08e5482

Browse files
znkrstapelberg
authored andcommitted
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>
1 parent 4f4f1c6 commit 08e5482

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unix/syscall_internal_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ func sockaddrIUCVToAny(in RawSockaddrIUCV) *RawSockaddrAny {
909909
var out RawSockaddrAny
910910
copy(
911911
(*(*[SizeofSockaddrAny]byte)(unsafe.Pointer(&out)))[:],
912-
(*(*[SizeofSockaddrUnix]byte)(unsafe.Pointer(&in)))[:],
912+
(*(*[SizeofSockaddrIUCV]byte)(unsafe.Pointer(&in)))[:],
913913
)
914914
return &out
915915
}

0 commit comments

Comments
 (0)