From: xie xingguo Date: Tue, 5 Jan 2016 08:10:07 +0000 (+0800) Subject: os: put a guard when read the entire object X-Git-Tag: v10.0.3~86^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c07dcd53dc3fde2322e60148c97a5338008756ea;p=ceph.git os: put a guard when read the entire object Otherwise the read operation may overflow. Fixes: #14229 Signed-off-by: xie xingguo --- diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index 0733dcc987b6..de00e63ae827 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -307,7 +307,7 @@ int MemStore::read( if (offset >= o->get_size()) return 0; size_t l = len; - if (l == 0) // note: len == 0 means read the entire object + if (l == 0 && offset == 0) // note: len == 0 means read the entire object l = o->get_size(); else if (offset + l > o->get_size()) l = o->get_size() - offset;