Skip to content

Commit

Permalink
Off-by-one error in pool consistency check
Browse files Browse the repository at this point in the history
I'm getting a segmentation fault on this line because pool->objects can be NULL. I suspect this > should be >=, though I'm not quite sure.

Signed-off-by: Eric Mertens <[email protected]>
  • Loading branch information
glguy authored Jul 10, 2024
1 parent b0e23ce commit 4adccee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static void obj_rm_from_pool(P11PROV_OBJ *obj)
}

/* LOCKED SECTION ------------- */
if (obj->poolid > pool->size || pool->objects[obj->poolid] != obj) {
if (obj->poolid >= pool->size || pool->objects[obj->poolid] != obj) {
ret = CKR_GENERAL_ERROR;
P11PROV_raise(pool->provctx, ret, "Objects pool in inconsistent state");
goto done;
Expand Down

0 comments on commit 4adccee

Please sign in to comment.