mirror of
https://github.com/golang/go
synced 2024-11-21 14:24:44 -07:00
crypto/openpgp: fixed dangerous use of for loop variable
In function readSignedMessage a pointer to for loop variable 'key' was incorrectly being assigned to md.SignedBy. Changed so that md.SignedBy is pointing to the 'more correct' memory position. R=golang-dev, r, agl CC=golang-dev https://golang.org/cl/4631088
This commit is contained in:
parent
7875ecb462
commit
582d6e5848
@ -250,11 +250,12 @@ FindLiteralData:
|
||||
md.IsSigned = true
|
||||
md.SignedByKeyId = p.KeyId
|
||||
keys := keyring.KeysById(p.KeyId)
|
||||
for _, key := range keys {
|
||||
for i, key := range keys {
|
||||
if key.SelfSignature.FlagsValid && !key.SelfSignature.FlagSign {
|
||||
continue
|
||||
}
|
||||
md.SignedBy = &key
|
||||
md.SignedBy = &keys[i]
|
||||
break
|
||||
}
|
||||
case *packet.LiteralData:
|
||||
md.LiteralData = p
|
||||
|
Loading…
Reference in New Issue
Block a user