Skip to content

Commit 060f0e1

Browse files
sympact06thomas-bc
andauthored
Fix static analysis blocker: bounds-guard m_directories in DpCatalog (#4964)
* fix: bounds-guard m_directories access in DpCatalog::fillBinaryTree (#4521) * add double bounds check instead --------- Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
1 parent e0beab9 commit 060f0e1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Svc/DpCatalog/DpCatalog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ Fw::CmdResponse DpCatalog::fillBinaryTree() {
358358
FwSizeType totalFiles = 0;
359359

360360
// get file listings from file system
361-
for (FwSizeType dir = 0; dir < this->m_numDirectories; dir++) {
361+
// double bounds to appease static analysis
362+
for (FwSizeType dir = 0; dir < this->m_numDirectories && dir < static_cast<FwSizeType>(DP_MAX_DIRECTORIES); dir++) {
362363
// read in each directory and keep track of total
363364
this->log_ACTIVITY_LO_ProcessingDirectory(this->m_directories[dir]);
364365
FwSizeType filesRead = 0;

0 commit comments

Comments
 (0)