mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 22:38:41 +02:00
add: safety bound checks for vec_get
This commit is contained in:
parent
d7bfa79284
commit
49e3ad528f
@ -121,5 +121,8 @@ void* vec_pop(struct Vector* vec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* vec_get(struct Vector* vec, uint32_t index) {
|
void* vec_get(struct Vector* vec, uint32_t index) {
|
||||||
|
if (index >= vec->length)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return vec->pages[index];
|
return vec->pages[index];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user