Skip to content

Commit

Permalink
Go's SSH library can panic without warning; recover.
Browse files Browse the repository at this point in the history
Ping #2877 -- but don't close yet in case there are more places.
  • Loading branch information
jefferai committed Jun 16, 2017
1 parent aab867a commit 0ee100e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion builtin/logical/ssh/path_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,16 @@ func (b *backend) calculateTTL(data *framework.FieldData, role *sshRole) (time.D
return ttl, nil
}

func (b *creationBundle) sign() (*ssh.Certificate, error) {
func (b *creationBundle) sign() (retCert *ssh.Certificate, retErr error) {
defer func() {
if r := recover(); r != nil {
err, ok := r.(error)
if ok {
retErr = err
}
}
}()

serialNumber, err := certutil.GenerateSerialNumber()
if err != nil {
return nil, err
Expand Down

0 comments on commit 0ee100e

Please sign in to comment.