35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
From 02dc73fd441f9f87bd237a1fbd0a7cab9d948cbe Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Mon, 3 Mar 2025 17:10:17 +0100
|
|
Subject: [PATCH] utils: Handle correctly CK_UNAVAILABLE_INFORMATION when
|
|
reading attributes
|
|
|
|
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
---
|
|
src/util.c | 9 +++++++--
|
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/util.c b/src/util.c
|
|
index a956f9d..bb1a389 100644
|
|
--- a/src/util.c
|
|
+++ b/src/util.c
|
|
@@ -84,8 +84,13 @@ CK_RV p11prov_fetch_attributes(P11PROV_CTX *ctx, P11PROV_SESSION *session,
|
|
return ret;
|
|
}
|
|
} else {
|
|
- attrs[i].attr.pValue =
|
|
- OPENSSL_zalloc(attrs[i].attr.ulValueLen + 1);
|
|
+ CK_ULONG len = attrs[i].attr.ulValueLen;
|
|
+ if (len == CK_UNAVAILABLE_INFORMATION) {
|
|
+ /* The attribute is known to the module, but not
|
|
+ * available on this object */
|
|
+ continue;
|
|
+ }
|
|
+ attrs[i].attr.pValue = OPENSSL_zalloc(len + 1);
|
|
if (!attrs[i].attr.pValue) {
|
|
ret = CKR_HOST_MEMORY;
|
|
P11PROV_raise(ctx, ret, "Failed to get attributes");
|
|
--
|
|
2.48.1
|
|
|