Browse Source

unix: fix uint64->int cast of control message header

Change-Id: I533233a08472b686d03573bcbae664c76919b18e
Reviewed-on: https://go-review.googlesource.com/22527
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Damien Neil 9 năm trước cách đây
mục cha
commit
c8bc69bc2d
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      unix/sockcmsg_unix.go

+ 1 - 1
unix/sockcmsg_unix.go

@@ -62,7 +62,7 @@ func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
 
 func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
 	h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
-	if h.Len < SizeofCmsghdr || int(h.Len) > len(b) {
+	if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
 		return nil, nil, EINVAL
 	}
 	return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil