From 4adccee1cece2e771e9025915a813dfca39e4f6b Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Wed, 10 Jul 2024 10:58:30 -0700 Subject: [PATCH] Off-by-one error in pool consistency check 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 --- src/objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects.c b/src/objects.c index 82258071..5724c5bc 100644 --- a/src/objects.c +++ b/src/objects.c @@ -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;