From cd884d3570d683d80f5344a005056f42c076aa88 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 5 Jul 2016 18:06:53 +0200 Subject: [PATCH] x/crypto/ssh: use BigEndian.Uint32 for decoding exit status. Change-Id: Iab40fe42454088a00abea61dfb6f368da9323eb3 Reviewed-on: https://go-review.googlesource.com/24726 Reviewed-by: Ian Lance Taylor Run-TryBot: Han-Wen Nienhuys TryBot-Result: Gobot Gobot --- ssh/session.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh/session.go b/ssh/session.go index 09eb009..a2b8ef4 100644 --- a/ssh/session.go +++ b/ssh/session.go @@ -9,6 +9,7 @@ package ssh import ( "bytes" + "encoding/binary" "errors" "fmt" "io" @@ -400,8 +401,7 @@ func (s *Session) wait(reqs <-chan *Request) error { for msg := range reqs { switch msg.Type { case "exit-status": - d := msg.Payload - wm.status = int(d[0])<<24 | int(d[1])<<16 | int(d[2])<<8 | int(d[3]) + wm.status = int(binary.BigEndian.Uint32(msg.Payload)) case "exit-signal": var sigval struct { Signal string