diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-10-16 18:18:05 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2018-10-17 10:13:32 +0200 |
commit | 033cd90806cb1e2eab7e799703757abc2f07052e (patch) | |
tree | 2a79943e38166afc4f99c29ce84a8724b342bb33 /p11-kit | |
parent | 1f78cb0b4dd193ec1f1b2b424a497a6c2edec043 (diff) |
proxy: Fix null dereference when reusing slots
Diffstat (limited to 'p11-kit')
-rw-r--r-- | p11-kit/proxy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c index 11e6165..8eaf205 100644 --- a/p11-kit/proxy.c +++ b/p11-kit/proxy.c @@ -307,7 +307,10 @@ proxy_create (Proxy **res, CK_FUNCTION_LIST **loaded, break; } py->mappings[py->n_mappings].funcs = funcs; - py->mappings[py->n_mappings].wrap_slot = j == n_mappings ? py->n_mappings + MAPPING_OFFSET : mappings[j].wrap_slot; + py->mappings[py->n_mappings].wrap_slot = + (n_mappings == 0 || j == n_mappings) ? + py->n_mappings + MAPPING_OFFSET : + mappings[j].wrap_slot; py->mappings[py->n_mappings].real_slot = slots[i]; ++py->n_mappings; } |