Commit 582d6e58 authored by Gideon Jan-Wessel Redelinghuys's avatar Gideon Jan-Wessel Redelinghuys Committed by Rob Pike

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
parent 7875ecb4
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment