electronicarts / CnC_Remastered_Collection

Other
18.34k stars 4.74k forks source link

Sidebar code has off-by-1 error can cause game to crash if too many items are added to the sidebar. #105

Open Revenent opened 4 years ago

Revenent commented 4 years ago

https://github.com/electronicarts/CnC_Remastered_Collection/blob/7d496e8a633a8bbf8a14b65f490b4d21fa32ca03/TIBERIANDAWN/SIDEBAR.CPP#L1440

https://github.com/electronicarts/CnC_Remastered_Collection/blob/7d496e8a633a8bbf8a14b65f490b4d21fa32ca03/TIBERIANDAWN/SIDEBARGlyphx.CPP#L362

Both use "BuildableCount <= MAX_BUILDABLES", instead of "BuildableCount < MAX_BUILDABLES".

Not a major bug, since the game normally doesn't allow (even with capturing) that many item types to be added. But mods that add new unit types, or mods that allow all unit types can and probably will hit this limit.

Revenent commented 4 years ago

Note, REDALERT code base has the same bug.