Skip to content

Commit 8896bd6

Browse files
committed
Handle invalid sslkey file
#1915
1 parent 85f15c4 commit 8896bd6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pgconn/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,9 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P
721721
return nil, fmt.Errorf("unable to read sslkey: %w", err)
722722
}
723723
block, _ := pem.Decode(buf)
724+
if block == nil {
725+
return nil, errors.New("failed to decode sslkey")
726+
}
724727
var pemKey []byte
725728
var decryptedKey []byte
726729
var decryptedError error

0 commit comments

Comments
 (0)