From 194b9bddffadc31cb489df0fe0277cfc0e7c9f7b Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 28 Jun 2024 13:33:58 -0500 Subject: [PATCH] Update mongo/options/clientoptions.go Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com> --- mongo/options/clientoptions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongo/options/clientoptions.go b/mongo/options/clientoptions.go index 0ec15537cd..05c00f5d22 100644 --- a/mongo/options/clientoptions.go +++ b/mongo/options/clientoptions.go @@ -1175,11 +1175,11 @@ func addClientCertFromSeparateFiles(cfg *tls.Config, keyFile, certFile, keyPassw if certSize > 64*1024*1024 { return "", errors.New("X.509 certificate must be less than 64 MiB") } - dataSize := keySize + certSize + 1 + dataSize := int64(keySize) + int64(certSize) + 1 if dataSize > math.MaxInt { return "", errors.New("size overflow") } - data := make([]byte, 0, dataSize) + data := make([]byte, 0, int(dataSize)) data = append(data, keyData...) data = append(data, '\n') data = append(data, certData...)