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 <iant@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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 @@
import (
"bytes"
+ "encoding/binary"
"errors"
"fmt"
"io"
@@ -400,8 +401,7 @@
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