From 5987f389c608df74b4d72c6884d99d0fd1c71bcf Mon Sep 17 00:00:00 2001 From: Arkshine Date: Fri, 31 Jul 2015 15:45:32 +0200 Subject: [PATCH] Fix some potiental issues --- amxmodx/amxmodx.cpp | 20 ++++++++++---------- modules/dod/dodfun/CMisc.h | 2 +- modules/dod/dodx/usermsg.cpp | 5 ++++- modules/regex/CRegEx.cpp | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index a51dd331..bd4883dc 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -1423,19 +1423,19 @@ static cell AMX_NATIVE_CALL get_plugin(AMX *amx, cell *params) /* 11 param */ set_amxstring(amx, params[8], a->getAuthor(), params[9]); set_amxstring(amx, params[10], a->getStatus(), params[11]); + if (params[0] / sizeof(cell) >= 12) + { + cell *jit_info = get_amxaddr(amx, params[12]); +#if defined AMD64 || !defined JIT + *jit_info = 0; +#else + *jit_info = a->isDebug() ? 0 : 1; +#endif + } + return a->getId(); } - if (params[0] / sizeof(cell) >= 12) - { - cell *jit_info = get_amxaddr(amx, params[12]); -#if defined AMD64 || !defined JIT - *jit_info = 0; -#else - *jit_info = a->isDebug() ? 0 : 1; -#endif - } - return -1; } diff --git a/modules/dod/dodfun/CMisc.h b/modules/dod/dodfun/CMisc.h index 7e2f6d06..2861ee78 100644 --- a/modules/dod/dodfun/CMisc.h +++ b/modules/dod/dodfun/CMisc.h @@ -280,7 +280,7 @@ class CObjective { public: int count; objinfo_t obj[12]; - inline void Clear() { count = 0; memset(obj,0,sizeof(objinfo_s)); } + inline void Clear() { count = 0; memset(obj,0,sizeof(obj)); } void SetKeyValue( int index, char *keyname, char *value ); void InitObj(int dest = MSG_ALL , edict_t* ed = NULL); diff --git a/modules/dod/dodx/usermsg.cpp b/modules/dod/dodx/usermsg.cpp index bbcf3b0c..0985f826 100644 --- a/modules/dod/dodx/usermsg.cpp +++ b/modules/dod/dodx/usermsg.cpp @@ -152,10 +152,13 @@ void Client_Health_End(void* mValue) if ( !isModuleActive() ) return; + if (!mPlayer) + return; + edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor; int damage = (int)mPlayer->pEdict->v.dmg_take; - if ( !mPlayer || !damage || !enemy ) + if (!damage || !enemy) return; int weapon = 0; diff --git a/modules/regex/CRegEx.cpp b/modules/regex/CRegEx.cpp index d98b1241..8428bc3f 100644 --- a/modules/regex/CRegEx.cpp +++ b/modules/regex/CRegEx.cpp @@ -583,7 +583,7 @@ int RegEx::Replace(char *text, size_t textMaxLen, const char *replace, size_t re */ if (flags & PCRE_DUPNAMES) { - memset(ovector, 0, REGEX_MAX_SUBPATTERNS); + memset(ovector, 0, REGEX_MAX_SUBPATTERNS * sizeof(int)); /** * pcre_copy_named_substring needs a vector containing sub-patterns ranges