Skip to content

Commit 344f90d

Browse files
author
Kevin Moloney
committed
Fix Klocwork#2051,2060: Array may be outside index
* Added check to ensure _data_len is within index values. * Had to repeat the branch statement rather than move it because of memcpy. Signed-off-by: Kevin Moloney <kevin.moloney@emutex.com>
1 parent cacac37 commit 344f90d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/CurieBle/src/BleCharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ BleCharacteristic::_setValue(void)
165165
if (!_initialised)
166166
return BLE_STATUS_WRONG_STATE;
167167

168-
if (_data_len > _char_data.max_len)
168+
if (_data_len > BLE_MAX_ATTR_DATA_LEN)
169169
return BLE_STATUS_NOT_ALLOWED;
170170

171171
status = ble_client_gatts_set_attribute_value(_handles.value_handle,

0 commit comments

Comments
 (0)