Fix comparison using narrow types in loop condition

* Spotted by GitHub CodeQL vulnerability scanner
* Related to: CWE-190, CWE-197 and CWE-835.
This commit is contained in:
pancake 2024-05-16 19:25:51 +02:00
parent 11a2ea2863
commit 1883e9e7ec

View File

@ -9,7 +9,7 @@ static unsigned short *make_id2insn(const insn_map *insns, unsigned int size)
{
// NOTE: assume that the max id is always put at the end of insns array
unsigned short max_id = insns[size - 1].id;
unsigned short i;
unsigned int i;
unsigned short *cache =
(unsigned short *)cs_mem_calloc(max_id + 1, sizeof(*cache));