Skip to content

Commit 0b19a52

Browse files
Update checkbufferoverrun.cpp
1 parent 8effc6c commit 0b19a52

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ static const ValueFlow::Value *getBufferSizeValue(const Token *tok)
6868
auto it = std::find_if(tokenValues.cbegin(), tokenValues.cend(), std::mem_fn(&ValueFlow::Value::isBufferSizeValue));
6969
if (it != tokenValues.cend())
7070
return &*it;
71-
it = std::find_if(tokenValues.cbegin(), tokenValues.cend(), std::mem_fn(&ValueFlow::Value::isContainerSizeValue));
72-
return it == tokenValues.cend() ? nullptr : &*it;
71+
it = std::find_if(tokenValues.cbegin(), tokenValues.cend(), [](const ValueFlow::Value& v) {
72+
return v.isContainerSizeValue() && v.isKnown();
73+
});
7374
}
7475

7576
static const Token* getRealBufferTok(const Token* tok) {

0 commit comments

Comments
 (0)