b3yc0d3 / exas

Execute commands as another user

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`inarray` function broken

McModknower opened this issue · comments

Your inarray function is broken as it always assumes that there is exactly one element in the array.

To quote cppreference:

Note that if a has pointer type (such as after array-to-pointer conversion of function parameter type adjustment), this expression would simply divide the number of bytes in a pointer type by the number of bytes in the pointed type.

Since in your case the element type is also a pointer, it divides the size of a pointer by the size of a pointer, resulting in 1.

To fix this you need to either pass the amount of elements in the arrays, or make sure the end of the arrays is marked with NULL and scan for that.