From c9e84c563db7388ff00896604f74a72c74c47a41 Mon Sep 17 00:00:00 2001 From: Twilight Suzuka Date: Tue, 3 Jan 2006 21:48:59 +0000 Subject: [PATCH] Updated to include additional protection for PDATA. --- dlls/BB/bb.cpp | 5 +++++ dlls/BB/bb.ncb | Bin 191488 -> 273408 bytes dlls/BB/pdata.h | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/BB/bb.cpp b/dlls/BB/bb.cpp index bdfd5918..94e1d828 100644 --- a/dlls/BB/bb.cpp +++ b/dlls/BB/bb.cpp @@ -31,6 +31,11 @@ static cell AMX_NATIVE_CALL get_user_level(AMX *amx,cell *params) static cell AMX_NATIVE_CALL set_user_level(AMX *amx,cell *params) { + if(GetUserLevel(params[0]) > params[2]) + { + MF_LogError(amx,AMX_ERR_NATIVE,"Must set to a level higher than current one!"); + return 0; + } SetUserLevel(params[1], params[2] ); return 1; } diff --git a/dlls/BB/bb.ncb b/dlls/BB/bb.ncb index 60e55f562f32f36c04a0bae15ebc389a391074e3..b1106abdcbe7a89395a9994aff0f7b5647732e15 100644 GIT binary patch delta 3591 zcmY+H4OmoF8pq%F+%v-fl4!_>VhtcTxG4CIXbK4}lph1KiAH{)C?<=PXqXhEqM}Qi z)a}V8xn{Ll;))7Nty_q#xx2N}uA5pGxVpOkGc$g0&-3HH_kZ5^J?Fgl z-17{M_CQB_@D|%WflO4Sk>~PfH%A`RqR(BwdD9Py<0dX|*EuLYF9_G&QSz+jObZp= z*WGOC)ZXo7v9K`wTSQmjTI&WYziAbFwmSSCAhLQBn8-vsXA$*Pk3LP3q=wl@Gsi(h@sv&(G~_OkD1nk`9Np*BT%~Ky z>DgTzq917!!TP0EA&v4AqMH4R;bA6r`BkM1QR}v<vl5baDJw9s3cAPZV5YHdb6y?z??M(gX*=-{nU15oR|Dwgcz z%BzUg%D2yOIVxh4argT8Q$Ms5{fNpth^8Rk3O+*2lrU@q+@DlB?7mFYdv98dwzWD! z`}MMguE^@x%DN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pdata.h index c8698b98..54aaa9fc 100644 --- a/dlls/BB/pdata.h +++ b/dlls/BB/pdata.h @@ -11,10 +11,20 @@ #define EXTRAOFFSET 0 // no change in Windows builds #endif // defined __linux__ +inline edict_t* MF_GetEntityEdict( long& EntID ) +{ + if( (EntID > 0) && (EntID <= (gpGlobals->maxClients) ) ) + return MF_GetPlayerEdict( EntID ); + + return NULL; +} + template inline void SetPData( long& targetid, long offset, ValueType value, bool reset = false ) { - edict_t* target = MF_GetPlayerEdict( targetid ); + edict_t* target = MF_GetEntityEdict( targetid ); + if(target == NULL) return; + *((ValueType *)target->pvPrivateData + offset + EXTRAOFFSET) = value; if(reset) UpdateBBHud( targetid ); }; @@ -22,7 +32,8 @@ inline void SetPData( long& targetid, long offset, ValueType value, bool reset = template inline ValueType GetPData( long& targetid, long offset, ValueType value ) { - edict_t* target = MF_GetPlayerEdict( targetid ); + edict_t* target = MF_GetEntityEdict( targetid ); + if(target == NULL) return NULL; return *((ValueType *)target->pvPrivateData + offset + EXTRAOFFSET); }