Add a cheap but important check to make sure that offsets do not point
outside of memory-mapped area.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/203
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
uint32_t children[INDEX_CHILDMAX];
unsigned char first, last;
- if ((offset & INDEX_NODE_MASK) == 0)
+ if ((offset & INDEX_NODE_MASK) == 0 || (offset & INDEX_NODE_MASK) >= idx->size)
return NULL;
p = (char *)p + (offset & INDEX_NODE_MASK);