commit | 4f8c76a9752541058ee4b5bd59b2c27eadda7262 | [log] [tgz] |
---|---|---|
author | Mikio Hara <mikioh.mikioh@gmail.com> | Tue Oct 03 12:23:07 2017 +0900 |
committer | Mikio Hara <mikioh.mikioh@gmail.com> | Wed Oct 04 03:46:34 2017 +0000 |
tree | 33678f9cf812dee7859f17e287abd7391bfa77b8 | |
parent | 0a9397675ba34b2845f758fe3cd68828369c6517 [diff] [blame] |
internal/socket: don't crash with empty Message.Buffers Fixes golang/go#22117. Change-Id: I0d9c3e126aaf97cd297c84e064e9a521ddac626f Reviewed-on: https://go-review.googlesource.com/67750 Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/internal/socket/msghdr_linux_64bit.go b/internal/socket/msghdr_linux_64bit.go index 9f78706..610fc4f 100644 --- a/internal/socket/msghdr_linux_64bit.go +++ b/internal/socket/msghdr_linux_64bit.go
@@ -10,8 +10,12 @@ import "unsafe" func (h *msghdr) setIov(vs []iovec) { + l := len(vs) + if l == 0 { + return + } h.Iov = &vs[0] - h.Iovlen = uint64(len(vs)) + h.Iovlen = uint64(l) } func (h *msghdr) setControl(b []byte) {