Skip to content

Commit

Permalink
Fix panic when parsing empty EdDSA public key
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Jun 19, 2023
1 parent 6f98819 commit fea64f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openpgp/packet/public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ func (pk *PublicKey) parseEdDSA(r io.Reader) (err error) {
return
}

if len(pk.p.Bytes()) == 0 {
return errors.StructuralError("empty EdDSA public key")
}

pub := eddsa.NewPublicKey(c)

switch flag := pk.p.Bytes()[0]; flag {
Expand Down

0 comments on commit fea64f7

Please sign in to comment.