Skip to content

Commit

Permalink
Prevent printing empty date in list-objects
Browse files Browse the repository at this point in the history
Signed-off-by: Zoltan Fridrich <[email protected]>
  • Loading branch information
ZoltanFridrich committed Sep 13, 2023
1 parent 70b7ee8 commit ef5a2b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions p11-kit/list-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ print_date_attribute (p11_list_printer *printer,
char month[3] = { '\0' };
char day[3] = { '\0' };

if (attr->ulValueLen == CK_UNAVAILABLE_INFORMATION)
if (attr->ulValueLen == CK_UNAVAILABLE_INFORMATION ||
attr->ulValueLen < sizeof (CK_DATE))
return;

type_str = p11_constant_nick (p11_constant_types, attr->type);
Expand All @@ -155,7 +156,8 @@ print_bool_attribute (p11_list_printer *printer,
{
const char *type_str;

if (attr->ulValueLen == CK_UNAVAILABLE_INFORMATION)
if (attr->ulValueLen == CK_UNAVAILABLE_INFORMATION ||
attr->ulValueLen < sizeof (CK_BBOOL))
return;

type_str = p11_constant_nick (p11_constant_types, attr->type);
Expand Down

0 comments on commit ef5a2b9

Please sign in to comment.