Handle invalid sslkey file

https://github.com/jackc/pgx/issues/1915
pull/1919/head
Jack Christensen 2024-02-24 09:24:26 -06:00
parent 85f15c4b3c
commit 8896bd6977
1 changed files with 3 additions and 0 deletions

View File

@ -721,6 +721,9 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P
return nil, fmt.Errorf("unable to read sslkey: %w", err)
}
block, _ := pem.Decode(buf)
if block == nil {
return nil, errors.New("failed to decode sslkey")
}
var pemKey []byte
var decryptedKey []byte
var decryptedError error