mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-15 02:07:21 +00:00
mesh: Fix overflow of ivu_duration value
Bluetooth Mesh require minimum limit time to enter iv update state or return to iv nornal state. For Zephyr bluetooth mesh implementation, use`ivu_duration` type `uint8_t` to represent current time, but if the time is more than 255 hours, there will be problems due to the overflow of 8-bit unassigned variables. This is port of f105455ebe6930c5004d46ffdc996aafa18fc593
This commit is contained in:
committed by
Łukasz Rymanowski
parent
6681f63b32
commit
bf6c4196fd
@@ -815,7 +815,8 @@ done:
|
||||
|
||||
static void ivu_refresh(struct ble_npl_event *work)
|
||||
{
|
||||
bt_mesh.ivu_duration += BT_MESH_IVU_HOURS;
|
||||
bt_mesh.ivu_duration = MIN(UINT8_MAX,
|
||||
bt_mesh.ivu_duration + BT_MESH_IVU_HOURS);
|
||||
|
||||
BT_DBG("%s for %u hour%s",
|
||||
atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_IN_PROGRESS) ?
|
||||
|
||||
Reference in New Issue
Block a user