diff options
Diffstat (limited to 'libgo/go/syscall/netlink_linux.go')
-rw-r--r-- | libgo/go/syscall/netlink_linux.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libgo/go/syscall/netlink_linux.go b/libgo/go/syscall/netlink_linux.go index 1b73dce827..1cda8c7704 100644 --- a/libgo/go/syscall/netlink_linux.go +++ b/libgo/go/syscall/netlink_linux.go @@ -1,4 +1,4 @@ -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -129,10 +129,11 @@ func ParseNetlinkMessage(b []byte) ([]NetlinkMessage, error) { func netlinkMessageHeaderAndData(b []byte) (*NlMsghdr, []byte, int, error) { h := (*NlMsghdr)(unsafe.Pointer(&b[0])) - if int(h.Len) < NLMSG_HDRLEN || int(h.Len) > len(b) { + l := nlmAlignOf(int(h.Len)) + if int(h.Len) < NLMSG_HDRLEN || l > len(b) { return nil, nil, 0, EINVAL } - return h, b[NLMSG_HDRLEN:], nlmAlignOf(int(h.Len)), nil + return h, b[NLMSG_HDRLEN:], l, nil } // NetlinkRouteAttr represents a netlink route attribute. |