Update simple_pre_lag.cpp - #1440
Conversation
jafingerhut
left a comment
There was a problem hiding this comment.
Looks reasonable to me, although it is not easy for me to find other references in the code to what the range of values is expected to be.
Because C++ uses 0-based indexing for fixed-size structures, a size/count of LAG_MAX_ENTRIES means valid index values are 0 through LAG_MAX_ENTRIES - 1. Passing lag_index == LAG_MAX_ENTRIES was hitting array boundary limits, so changing > to >= catches that edge case and prevents out-of-bounds access. |
|
Is there a reason you wanted to close this PR without merging it? |
Apologies for the confusion, it was accidentally closed during a branch cleanup. I have reopened this fix in PR #1444 on a clean branch. |
Fix off-by-one error in LAG index validation
Change the index boundary check in mc_set_lag_membership from > to >=. Previously, passing lag_index == LAG_MAX_ENTRIES bypassed the error check and resulted in out-of-bounds access.