sourcemod/plugins
Oliver John Hitchcock f9ad35badf
Stop EntRefToEntIndex returning garbage if a bad parameter is passed (#1323)
* Stop EntRefToEntIndex returning garbage if a bad parameter is passed

Seen multiple bad usage of this function that works only because whatever was passed in was returned as it wasnt an entity reference.
This code should have worked and would be expected to have returned something invalid but instead the the input was returned which allowed the code to work when really it is bad code.
See for one such case https://discordapp.com/channels/335290997317697536/335290997317697536/736518488314871868

* Update documentation of EntRefToEntIndex

Added the error text saying what shall be returned when a invalid parameter is passed.

* Validate entity index instead of just returning INVALID_EHANDLE_INDEX

Not sure if it needs this much validation but this just mirrors how IsValidEntity works, so the entity index returned should be valid else INVALID_EHANDLE_INDEX is returned.

* EntRefToEntIndex improve doc comments to better represent functionality

---------

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
2024-04-25 23:19:04 +00:00
..
admin-flatfile Fix admin-flatfile.sp includes (#2043) 2023-09-13 18:28:35 +02:00
adminmenu Add missing return values in plugins 2021-08-21 14:11:20 -07:00
basebans Add missing return values in plugins 2021-08-21 14:11:20 -07:00
basecomm Add missing return values in plugins 2021-08-21 14:11:20 -07:00
basecommands fix: Print full map name in Log instead of args (#1907) 2023-01-15 13:32:41 -05:00
basevotes Prevent enum shadowing & pin sourcemod for build fixes (#1661) 2021-12-10 14:22:04 -08:00
funcommands Add GetCmdArgFloat(Ex) stocks (#1742) 2022-04-12 11:17:05 +01:00
funvotes Add missing return values in plugins 2021-08-21 14:11:20 -07:00
include Stop EntRefToEntIndex returning garbage if a bad parameter is passed (#1323) 2024-04-25 23:19:04 +00:00
playercommands Add missing return values in plugins 2021-08-21 14:11:20 -07:00
testsuite Run basic native tests using hl2sdk-mock in CI (#2015) 2023-07-12 22:58:28 +02:00
admin-flatfile.sp Fix admin-flatfile.sp includes (#2043) 2023-09-13 18:28:35 +02:00
admin-sql-prefetch.sp Update small plugins for transitional syntax (#506) 2016-05-11 09:32:34 -04:00
admin-sql-threaded.sp Add support for other Steam ID formats to admin-sql-threaded (#1520). 2021-10-24 09:57:03 -04:00
adminhelp.sp Add CommandIterator.ConVarFlags property (#1869) 2022-12-04 12:24:56 +01:00
adminmenu.sp Create GlobalForward & PrivateForward methodmaps (#1004) 2019-05-29 14:17:42 -07:00
AMBuilder Fix admin-flatfile.sp includes (#2043) 2023-09-13 18:28:35 +02:00
antiflood.sp Introduce enum structs to core sm plugins 2018-12-15 13:51:03 -08:00
basebans.sp Ignore chat triggers for interactive ban reason (#2067) 2023-10-16 19:43:00 +02:00
basechat.sp Add "sm_dsay" command to basechat for sending HUD messages (#1889) 2022-12-20 00:00:43 +00:00
basecomm.sp Fix basecomm failing to load on games without sv_alltalk (#1212) 2020-03-11 21:24:16 -07:00
basecommands.sp Prevent basecommands from printing to disconnected clients (#1138) 2020-02-06 22:32:16 -08:00
basetriggers.sp Update basetriggers.sp for Dystopia compatibility (#2075) 2023-11-06 16:10:46 +00:00
basevotes.sp Add logging to all basevote vote results (#1794) 2022-10-30 23:26:17 +01:00
clientprefs.sp cookies: Align output with sm_help (#977) 2020-07-08 20:38:35 -07:00
compile.sh Add spacing to compile.sh (#53) 2016-10-24 14:50:24 +01:00
funcommands.sp Add missing return values in plugins 2021-08-21 14:11:20 -07:00
funvotes.sp Allow h-flag admins to bypass vote delay (#1733) 2022-04-12 11:19:54 +01:00
mapchooser.sp Update to the new SourcePawn compiler. 2021-10-26 17:45:48 -10:00
nextmap.sp Clear sm_nextmap so we don't get stuck in a loop (#1545) 2023-07-03 20:48:01 +02:00
nominations.sp nominations: implement map not in pool phrase (#597) 2023-03-29 18:39:54 -07:00
playercommands.sp Update small plugins for transitional syntax (#506) 2016-05-11 09:32:34 -04:00
randomcycle.sp Prevent duplicate map changes in randomcycle.sp (#1428) 2021-03-14 01:02:42 -08:00
reservedslots.sp Fixed typo in reservedslots.sp (#2109) 2024-02-01 10:36:28 +01:00
rockthevote.sp Add missing return values in plugins 2021-08-21 14:11:20 -07:00
sounds.sp Prevent commands from being run on the client with sm_play (#1832) 2023-09-27 16:51:07 +02:00
sql-admin-manager.sp Add PostgreSQL database driver (#32) 2021-03-11 11:21:51 +01:00