Skip to content

Commit

Permalink
Check by attribute len for validity of attribute
Browse files Browse the repository at this point in the history
Any other parameter of the attribute is not appropriate to check if
there is a valid value.

Signed-off-by: Simo Sorce <simo@redhat.com>
  • Loading branch information
simo5 committed Apr 18, 2023
1 parent 99adf96 commit c584f3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,11 @@ CK_RV p11prov_obj_find(P11PROV_CTX *provctx, P11PROV_SESSION *session,
/* nothing to find for us */
return CKR_OK;
}
if (id.pValue != NULL) {
if (id.ulValueLen != 0) {
template[tsize] = id;
tsize++;
}
if (label.pValue != NULL) {
if (label.ulValueLen != 0) {
template[tsize] = label;
tsize++;
}
Expand Down Expand Up @@ -1011,7 +1011,7 @@ static P11PROV_OBJ *find_associated_obj(P11PROV_CTX *provctx, P11PROV_OBJ *obj,
P11PROV_debug("Find associated object");

id = p11prov_obj_get_attr(obj, CKA_ID);
if (!id) {
if (!id || id->ulValueLen == 0) {
P11PROV_raise(provctx, CKR_GENERAL_ERROR, "No CKA_ID in source object");
goto done;
}
Expand Down

0 comments on commit c584f3d

Please sign in to comment.