From 4e328366efc3a2cccd286a7e191663af24dfe50d Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 3 Apr 2024 17:50:48 +0200 Subject: validate rpc chunk responses (#36) * Validate size of found chunks in cas/cache --- src/zenstore/blockstore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/zenstore/blockstore.cpp') diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 69487f9dc..dfa852434 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -482,7 +482,11 @@ BlockStore::TryGetChunk(const BlockStoreLocation& Location) const { if (const Ref& Block = BlockIt->second; Block) { - return Block->GetChunk(Location.Offset, Location.Size); + IoBuffer Chunk = Block->GetChunk(Location.Offset, Location.Size); + if (Chunk.GetSize() == Location.Size) + { + return Chunk; + } } } return IoBuffer(); -- cgit v1.2.3