From 3cd6ffbfac3cb8f8aeace0deee46e49567cb5460 Mon Sep 17 00:00:00 2001 From: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:54:51 +0200 Subject: [PATCH] Handle attribute size -1 gracefully. Signed-off-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> --- cryptoki/src/session/object_management.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cryptoki/src/session/object_management.rs b/cryptoki/src/session/object_management.rs index 3cec80d3..d97c3d70 100644 --- a/cryptoki/src/session/object_management.rs +++ b/cryptoki/src/session/object_management.rs @@ -513,7 +513,11 @@ impl Session { .zip(attributes.iter()) .filter_map(|(attr_info, attr_type)| { if let AttributeInfo::Available(size) = attr_info { - Some((*attr_type, vec![0; *size])) + if *size != usize::MAX { + Some((*attr_type, vec![0; *size])) + } else { + None + } } else { None }