MCPcopy Index your code
hub / github.com/subtrace/subtrace / vmReadString

Method vmReadString

cmd/run/engine/process/vm.go:114–127  ·  view source on GitHub ↗

vmReadString reads a NULL-terminated string from the process virtual memory starting at ptr.

(n *seccomp.Notif, ptr uintptr, maxSize int)

Source from the content-addressed store, hash-verified

112// vmReadString reads a NULL-terminated string from the process virtual memory
113// starting at ptr.
114func (p *Process) vmReadString(n *seccomp.Notif, ptr uintptr, maxSize int) (string, syscall.Errno, error) {
115 if ptr == 0 {
116 return "", unix.EINVAL, nil
117 }
118
119 b, errno, err := p.vmReadBytes(n, ptr, maxSize)
120 if errno != 0 || err != nil {
121 return "", errno, err
122 }
123 if idx := bytes.IndexByte(b, 0); idx != -1 {
124 b = b[:idx]
125 }
126 return string(b), 0, nil
127}
128
129// vmReadSockaddr reads a sockaddr struct of size bytes to the process's
130// virtual memory starting at ptr.

Callers 1

resolvePathMethod · 0.95

Calls 1

vmReadBytesMethod · 0.95

Tested by

no test coverage detected