Skip to content

Commit abbc44d

Browse files
thatnealpatelgopherbot
authored andcommitted
ssh: fix incorrect operator order
Arithmetic is incorrectly applied to 'byte' instead of 'int' resulting in a possible overflow that allows for a panic. Fixes CVE-2026-46597 Fixes golang/go#79561 Change-Id: I83edabeeda676f0209d29d5e2554890bbd0eef8f Reviewed-on: https://go-review.googlesource.com/c/crypto/+/781620 Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Gopher Robot <gobot@golang.org> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent e052873 commit abbc44d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ssh/cipher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func (c *gcmCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error)
407407
return nil, fmt.Errorf("ssh: illegal padding %d", padding)
408408
}
409409

410-
if int(padding+1) >= len(plain) {
410+
if int(padding)+1 >= len(plain) {
411411
return nil, fmt.Errorf("ssh: padding %d too large", padding)
412412
}
413413
plain = plain[1 : length-uint32(padding)]

0 commit comments

Comments
 (0)