From 7ddff919c1b020cc729b49db67f820fea033c09c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 5 Sep 2019 21:55:56 -0400 Subject: [PATCH] DiscBase: Prevent potential off-by-one case within getPartitonNodeCount() We should be comparing with >= instead of >. --- include/nod/DiscBase.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/nod/DiscBase.hpp b/include/nod/DiscBase.hpp index 87ac776..f5d54be 100644 --- a/include/nod/DiscBase.hpp +++ b/include/nod/DiscBase.hpp @@ -351,8 +351,9 @@ public: const Header& getHeader() const { return m_header; } const IDiscIO& getDiscIO() const { return *m_discIO; } size_t getPartitonNodeCount(size_t partition = 0) const { - if (partition > m_partitions.size()) + if (partition >= m_partitions.size()) { return -1; + } return m_partitions[partition]->getNodeCount(); }