vmReadString reads a NULL-terminated string from the process virtual memory starting at ptr.
(n *seccomp.Notif, ptr uintptr, maxSize int)
| 112 | // vmReadString reads a NULL-terminated string from the process virtual memory |
| 113 | // starting at ptr. |
| 114 | func (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. |
no test coverage detected