Skip to content
This repository has been 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
merged 1 commit into from
Feb 25, 2018

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 <[email protected]>
@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