mirror of
https://github.com/golang/net.git
synced 2026-03-31 10:27:08 +09:00
ipv4: use unsafe.Sizeof on struct size, not pointer size
Fix for CL 203400. Change-Id: Ia0006cdeff4992a218c7a355bd83354138706833 Reviewed-on: https://go-review.googlesource.com/c/net/+/203777 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
53de4c7853
commit
fe3aa8a452
@@ -36,6 +36,6 @@ func marshalInterface(b []byte, cm *ControlMessage) []byte {
|
||||
|
||||
func parseInterface(cm *ControlMessage, b []byte) {
|
||||
var sadl syscall.SockaddrDatalink
|
||||
copy((*[unsafe.Sizeof(&sadl)]byte)(unsafe.Pointer(&sadl))[:], b)
|
||||
copy((*[unsafe.Sizeof(sadl)]byte)(unsafe.Pointer(&sadl))[:], b)
|
||||
cm.IfIndex = int(sadl.Index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user