ssh/agent: add checking for empty SSH requests
Previously empty SSH requests would cause a panic. Change-Id: I8443fee50891b3d2b3b62ac01fb0b9e96244241f GitHub-Last-Rev: 64f00d2bf2ee722f53e68b6bd4f70c722d7694bd GitHub-Pull-Request: golang/crypto#58 Reviewed-on: https://go-review.googlesource.com/c/140237 Reviewed-by: Han-Wen Nienhuys <hanwen@google.com> Run-TryBot: Han-Wen Nienhuys <hanwen@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Han-Wen Nienhuys
parent
ffb98f7385
commit
7f87c0fbb8
@@ -541,6 +541,9 @@ func ServeAgent(agent Agent, c io.ReadWriter) error {
|
||||
return err
|
||||
}
|
||||
l := binary.BigEndian.Uint32(length[:])
|
||||
if l == 0 {
|
||||
return fmt.Errorf("agent: request size is 0")
|
||||
}
|
||||
if l > maxAgentResponseBytes {
|
||||
// We also cap requests.
|
||||
return fmt.Errorf("agent: request too large: %d", l)
|
||||
|
||||
Reference in New Issue
Block a user