Add missing sanity checks on element param on SetEntPropString for data props.
This commit is contained in:
parent
5cdf35d687
commit
1e1b23dc31
@ -2067,6 +2067,27 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
offset = info.actual_offset;
|
||||
|
||||
bIsStringIndex = (td->fieldType != FIELD_CHARACTER);
|
||||
|
||||
if (element != 0)
|
||||
{
|
||||
if (bIsStringIndex)
|
||||
{
|
||||
if (element < 0 || element >= td->fieldSize)
|
||||
{
|
||||
return pContext->ThrowNativeError("Element %d is out of bounds (Prop %s has %d elements).",
|
||||
element,
|
||||
prop,
|
||||
td->fieldSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return pContext->ThrowNativeError("Prop %s is not an array. Element %d is invalid.",
|
||||
prop,
|
||||
element);
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsStringIndex)
|
||||
{
|
||||
offset += (element * (td->fieldSizeInBytes / td->fieldSize));
|
||||
|
Loading…
Reference in New Issue
Block a user