MCPcopy Index your code
hub / github.com/google/gvisor / PushNullTerminatedByteSlice

Method PushNullTerminatedByteSlice

pkg/sentry/arch/stack.go:107–118  ·  view source on GitHub ↗

PushNullTerminatedByteSlice writes bs to the stack, followed by an extra null byte at the end. On error, the contents of the stack and the bottom cursor are undefined.

(bs []byte)

Source from the content-addressed store, hash-verified

105// byte at the end. On error, the contents of the stack and the bottom cursor
106// are undefined.
107func (s *Stack) PushNullTerminatedByteSlice(bs []byte) (int, error) {
108 // Note: Stack grows up, so write the terminal null byte first.
109 nNull, err := primitive.CopyUint8Out(s, StackBottomMagic, 0)
110 if err != nil {
111 return 0, err
112 }
113 n, err := primitive.CopyByteSliceOut(s, StackBottomMagic, bs)
114 if err != nil {
115 return 0, err
116 }
117 return n + nNull, nil
118}
119
120// StackLayout describes the location of the arguments and environment on the
121// stack.

Callers 2

LoadMethod · 0.95
LoadFunction · 0.80

Calls 2

CopyUint8OutFunction · 0.92
CopyByteSliceOutFunction · 0.92

Tested by

no test coverage detected