Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

plumbing: ssh, return error when creating public keys from invalid PEM#759

Merged
mcuadros merged 1 commit intosrc-d:masterfrom
mdelillo:invalid-ssh-key
Feb 25, 2018
Merged

plumbing: ssh, return error when creating public keys from invalid PEM#759
mcuadros merged 1 commit intosrc-d:masterfrom
mdelillo:invalid-ssh-key

Conversation

@mdelillo
Copy link
Contributor

If the pemBytes passed in is not valid, pem.Decode will return nil. Passing that to x509.IsEncryptedPEMBlock will panic when it tries to read Headers. This fix returns an error early rather than panicking.

@mcuadros
Copy link
Contributor

Please, can you Signed-off your commit? @mdelillo

* pem.Decode will return nil in this case, and passing that to x509.IsEncryptedBlock will cause it to panic

Signed-off-by: Mark DeLillo <github.med@delillo.org>
@mdelillo
Copy link
Contributor Author

Sure thing

@mcuadros mcuadros changed the title Return error when creating public keys from invalid PEM plumbing: ssh, return error when creating public keys from invalid PEM Feb 25, 2018
@mcuadros mcuadros merged commit defd0b8 into src-d:master Feb 25, 2018
@mdelillo mdelillo deleted the invalid-ssh-key branch February 25, 2018 20:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants