Skip to content

Commit

Permalink
Monitoring (watch) does not respect array bounds. #33
Browse files Browse the repository at this point in the history
  • Loading branch information
murinsel authored and azoitl committed Mar 5, 2024
1 parent 9f1de47 commit 1a4f103
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,21 @@ size_t CMonitoringHandler::getExtraSizeForEscapedChars(const CIEC_ANY& paDataVal

size_t CMonitoringHandler::getExtraSizeForEscapedCharsArray(const CIEC_ARRAY &paDataValue) {
size_t retVal = 0;

switch(paDataValue[0].getDataTypeID()){
auto lowerBound = paDataValue.getLowerBound();
auto upperBound = paDataValue.getUpperBound();
switch(paDataValue[lowerBound].getDataTypeID()){
case CIEC_ANY::e_STRING:
for(size_t i = 0; i < paDataValue.size(); i++) {
for (auto i = lowerBound; i <= upperBound; i++) {
retVal += forte::core::util::getExtraSizeForXMLEscapedChars(static_cast<const CIEC_STRING&>(paDataValue[static_cast<TForteUInt16>(i)]).getStorage().c_str()) + 10; //for opening and closing quotes or apos
}
break;
case CIEC_ANY::e_WSTRING:
for(size_t i = 0; i < paDataValue.size(); i++) {
for (auto i = lowerBound; i <= upperBound; i++) {
retVal += forte::core::util::getExtraSizeForXMLEscapedChars(static_cast<const CIEC_WSTRING&>(paDataValue[static_cast<TForteUInt16>(i)]).getValue()) + 10; //for opening and closing quotes or apos
}
break;
case CIEC_ANY::e_STRUCT:
for(size_t i = 0; i < paDataValue.size(); i++) {
for (auto i = lowerBound; i <= upperBound; i++) {
retVal += getExtraSizeForEscapedCharsStruct(static_cast<const CIEC_STRUCT&>(paDataValue[static_cast<TForteUInt16>(i)]));
}
break;
Expand Down

0 comments on commit 1a4f103

Please sign in to comment.