You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static boolean m_is_this_slot_in_use [MAX_CONCURRENT_TRANSACTIONS];
...
i = 0;
while (m_is_this_slot_in_use[i] && (i < MAX_CONCURRENT_TRANSACTIONS))
i ++;
Assume MAX_CONCURRENT_TRANSACTIONS = 2
On the first iteration of the loop, m_is_this_slot_in_use[i] will access array index 0, on the second pass array index 1, and on the third pass the out-of-bounds index 2, causing a buffer overflow.
The following simple fix will short-circuit the while loop, preventing the buffer overflow:
while ((i < MAX_CONCURRENT_TRANSACTIONS) && m_is_this_slot_in_use[i])
The text was updated successfully, but these errors were encountered:
Assume MAX_CONCURRENT_TRANSACTIONS = 2
On the first iteration of the loop, m_is_this_slot_in_use[i] will access array index 0, on the second pass array index 1, and on the third pass the out-of-bounds index 2, causing a buffer overflow.
The following simple fix will short-circuit the while loop, preventing the buffer overflow:
while ((i < MAX_CONCURRENT_TRANSACTIONS) && m_is_this_slot_in_use[i])
The text was updated successfully, but these errors were encountered: