From f4b7b0dca608650382709d00ef999c4e8a97e05f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Nov 2017 12:31:38 -0700 Subject: [PATCH] Bugfix: access history is fixed size now, make sure we do not read beyond the end. --- src/XrdFileCache/XrdFileCacheInfo.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/XrdFileCache/XrdFileCacheInfo.cc b/src/XrdFileCache/XrdFileCacheInfo.cc index 1912debe36e..90d2db71f2a 100644 --- a/src/XrdFileCache/XrdFileCacheInfo.cc +++ b/src/XrdFileCache/XrdFileCacheInfo.cc @@ -378,6 +378,7 @@ bool Info::GetLatestDetachTime(time_t& t) const { if (! m_store.m_accessCnt) return false; - t = m_store.m_astats[m_store.m_accessCnt-1].DetachTime; + size_t entry = std::min(m_store.m_accessCnt, m_maxNumAccess) - 1; + t = m_store.m_astats[entry].DetachTime; return true; }