Add check for size > 0.

If size <= 0 error will be throwed.
This commit is contained in:
ArKaNeMaN 2021-07-28 14:12:59 +03:00
parent a0d6570d31
commit 20d802368b
2 changed files with 7 additions and 1 deletions

View File

@ -4460,6 +4460,11 @@ static cell AMX_NATIVE_CALL arraycompare(AMX *amx, cell *params)
cell *with = get_amxaddr(amx, params[2]);
int size = params[3];
if(size < 1){
LogError(amx, AMX_ERR_NATIVE, "Invalid size (%d).", size);
return 0;
}
while (size--)
if (*with++ != *what++)
return 0;

View File

@ -3317,6 +3317,7 @@ native arrayset(any:array[], any:value, size);
* @param size Size of array
*
* @return Returns true if arrays are equaly, false otherwise.
* @error If size < 1.
*/
native bool:arraycompare(const any:what[], const any:with[], const size);