Skip to content

Commit

Permalink
LURE: Fix bounds checking
Browse files Browse the repository at this point in the history
CID 1003986 and CID 1003990.
  • Loading branch information
Torbjörn Andersson committed Apr 24, 2013
1 parent 048d246 commit 621364e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engines/lure/res_struct.cpp
Expand Up @@ -1262,7 +1262,7 @@ bool ValueTableData::isKnownField(uint16 fieldIndex) {
}

uint16 ValueTableData::getField(uint16 fieldIndex) {
if (fieldIndex > NUM_VALUE_FIELDS)
if (fieldIndex >= NUM_VALUE_FIELDS)
error("Invalid field index specified %d", fieldIndex);
// if (!isKnownField(fieldIndex))
// warning("Unknown field index %d in GET_FIELD opcode", fieldIndex);
Expand All @@ -1274,7 +1274,7 @@ uint16 ValueTableData::getField(FieldName fieldName) {
}

void ValueTableData::setField(uint16 fieldIndex, uint16 value) {
if (fieldIndex > NUM_VALUE_FIELDS)
if (fieldIndex >= NUM_VALUE_FIELDS)
error("Invalid field index specified %d", fieldIndex);
_fieldList[fieldIndex] = value;
// if (!isKnownField(fieldIndex))
Expand Down

0 comments on commit 621364e

Please sign in to comment.