Skip to content

Commit 91ff78c

Browse files
Update checkbufferoverrun.cpp
1 parent 12dfb16 commit 91ff78c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lib/checkbufferoverrun.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,11 @@ ValueFlow::Value CheckBufferOverrunImpl::getBufferSize(const Token *bufTok, cons
605605
}
606606
}
607607
} else if (checkStringLiteral && bufTok->tokType() == Token::Type::eString && bufTok->valueType()) {
608-
ValueFlow::Value strSizeVal;
609-
strSizeVal.setKnown();
610-
strSizeVal.valueType = ValueFlow::Value::ValueType::BUFFER_SIZE;
611608
const size_t charSize = bufTok->valueType()->getSizeOf(settings, ValueType::Accuracy::ExactOrZero, ValueType::SizeOf::Pointee);
612609
if (charSize > 0) {
610+
ValueFlow::Value strSizeVal;
611+
strSizeVal.setKnown();
612+
strSizeVal.valueType = ValueFlow::Value::ValueType::BUFFER_SIZE;
613613
strSizeVal.intvalue = (Token::getStrArraySize(bufTok) - index) * charSize;
614614
return strSizeVal;
615615
}

0 commit comments

Comments
 (0)