summaryrefslogtreecommitdiff
path: root/p11-kit/proxy.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-07-10 16:57:07 +0200
committerDaiki Ueno <ueno@gnu.org>2018-07-16 17:42:29 +0200
commitab27346ceb5d4e856671a033ac1f6521c86514a1 (patch)
tree7bddeb7af3c0d526754381b24ee2b857c22ad145 /p11-kit/proxy.c
parentfb5742cdecfde1c13d9ce610cdec050792cc57ca (diff)
proxy: Fail early if there is no slot mappings
Diffstat (limited to 'p11-kit/proxy.c')
-rw-r--r--p11-kit/proxy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c
index 916ee92..31b9bb2 100644
--- a/p11-kit/proxy.c
+++ b/p11-kit/proxy.c
@@ -123,6 +123,8 @@ map_slot_unlocked (Proxy *px,
if (slot > px->n_mappings) {
return CKR_SLOT_ID_INVALID;
+ } else if (px->n_mappings == 0) {
+ return CKR_SLOT_ID_INVALID;
} else {
assert (px->mappings);
memcpy (mapping, &px->mappings[slot], sizeof (Mapping));