ttrpc icon indicating copy to clipboard operation
ttrpc copied to clipboard

Block sending of oversize messages

Open acclassic opened this issue 1 year ago • 4 comments

While looking to solve the containerd bug #6248 (https://github.com/containerd/containerd/issues/6248#issue-1053682568) I saw that it was already solved but the message would only be checked for the length after sending. Like @dmcgowan noted the message should not even be sent because it will be discarded anyway. I changed the code so that the send function will check for the size and not send the message in case the length is longer than the max message length. I opted for an GRPC error code 8 (RESOURCE_EXHAUSTED) over error code 3 (INVALID_ARGUMENT) because it describes the error better. I hope that this is what we were looking for and I'm open to any input.

acclassic avatar Jan 20 '23 16:01 acclassic