Skip to content

Commit 079291e

Browse files
committed
Unmarshal the payload of a request.
This unmarshals the payload of a request instead of trimming the length field and then reading the remainder of the request.
1 parent 8d56bfa commit 079291e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

handlers.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ func (h *sshHandler) handleExec(req *ssh.Request) {
107107
h.Lock()
108108
defer h.Unlock()
109109

110-
cmdline := string(req.Payload[4:])
110+
var payload = struct{ Value string }{}
111+
ssh.Unmarshal(req.Payload, &payload)
112+
cmdline := payload.Value
111113

112114
// Initialize Cmd
113115
var cmd *exec.Cmd

0 commit comments

Comments
 (0)