From ca0af15523fd359ef347bfa978123be2355ce2eb Mon Sep 17 00:00:00 2001 From: Arjan Bal Date: Fri, 24 Jan 2025 00:29:25 +0530 Subject: [PATCH] Fix buf size in error message --- rpc_util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc_util.go b/rpc_util.go index 9fac2b08b48b..cd24a85975cb 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -692,9 +692,9 @@ func encode(c baseCodec, msg any) (mem.BufferSlice, error) { if err != nil { return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) } - if uint(b.Len()) > math.MaxUint32 { + if bufSize := uint(b.Len()); bufSize > math.MaxUint32 { b.Free() - return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) + return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", bufSize) } return b, nil }