diff --git a/pgconn/config.go b/pgconn/config.go index ddde89bd5..33a722579 100644 --- a/pgconn/config.go +++ b/pgconn/config.go @@ -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