summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/strace
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-12-03 21:53:51 +0000
committergVisor bot <gvisor-bot@google.com>2019-12-03 21:53:51 +0000
commit32997d909e183f346e8f9f901112ad158a801b03 (patch)
tree5bcf07db6d3fc81172382be906a98a2ac991c3c7 /pkg/sentry/strace
parent416c75a9628a86d3dfd20781c4339d96113b9c4e (diff)
parent43643752f05a0b25259b116558ccd870a539cc05 (diff)
Merge release-20191114.0-54-g4364375 (automated)
Diffstat (limited to 'pkg/sentry/strace')
-rw-r--r--pkg/sentry/strace/socket.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/sentry/strace/socket.go b/pkg/sentry/strace/socket.go
index 94334f6d2..51f2efb39 100644
--- a/pkg/sentry/strace/socket.go
+++ b/pkg/sentry/strace/socket.go
@@ -208,6 +208,15 @@ func cmsghdr(t *kernel.Task, addr usermem.Addr, length uint64, maxBytes uint64)
i += linux.SizeOfControlMessageHeader
width := t.Arch().Width()
length := int(h.Length) - linux.SizeOfControlMessageHeader
+ if length < 0 {
+ strs = append(strs, fmt.Sprintf(
+ "{level=%s, type=%s, length=%d, content too short}",
+ level,
+ typ,
+ h.Length,
+ ))
+ break
+ }
if skipData {
strs = append(strs, fmt.Sprintf("{level=%s, type=%s, length=%d}", level, typ, h.Length))