Skip to content

Commit 4235952

Browse files
committed
Fix buf size in error message
1 parent 67bee55 commit 4235952

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rpc_util.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@ func encode(c baseCodec, msg any) (mem.BufferSlice, error) {
692692
if err != nil {
693693
return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error())
694694
}
695-
if uint(b.Len()) > math.MaxUint32 {
695+
bufSize := uint(b.Len())
696+
if bufSize > math.MaxUint32 {
696697
b.Free()
697-
return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b))
698+
return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", bufSize)
698699
}
699700
return b, nil
700701
}

0 commit comments

Comments
 (0)