alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
489 stars 197 forks source link

Fix some misprints and mistakes in code, part 2 #1021

Closed UnrealKaraulov closed 2 years ago

UnrealKaraulov commented 2 years ago

Fix many useless break\s in code. Fix buffer overflow in non cstrike mods (MAX_WEAPONS misprints) and small other fixes.

UnrealKaraulov commented 2 years ago

@dvander but I think it can be issue in dod_weapon_type function, x > 31 .

https://github.com/alliedmodders/amxmodx/blob/383507daaf67939c9782366513cc5fb351849fb2/modules/dod/dodx/NBase.cpp#L268

UnrealKaraulov commented 2 years ago

@dvander possible only in this function need use MAX_WEAPONS instead of DODMAX_WEAPONS. (because 1<<31 is max possible value)

dvander commented 2 years ago

It seems like the intent was if ((weaponsbit & (1 << x)) != 0)

UnrealKaraulov commented 2 years ago

@dvander in any case, 31 bit is max, see http://cpp.sh/4fucs

Possible here only MAX_WEAPONS allowed or function logic has problem.

maybe need revert changes in only this function, you don't know who author of this mod? maybe need to ask him?

dvander commented 2 years ago

This code is like 20 years old. You're not going to find anyone who still remembers it.

UnrealKaraulov commented 2 years ago

I don't know it, maybe :)

Okay then just need wait for someone report about issues in this function :)