Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer overflow in machine_list.c #3

Closed
tyler124 opened this issue Dec 30, 2019 · 1 comment
Closed

Buffer overflow in machine_list.c #3

tyler124 opened this issue Dec 30, 2019 · 1 comment
Labels

Comments

@tyler124
Copy link

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])

@skliper
Copy link
Contributor

skliper commented Mar 24, 2022

Closing as obsolete (applies to v2.X)

@skliper skliper closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants