Skip to content

Commit

Permalink
db: CKA_ALLOWED_MECHANISMS fix NULL pointer dereference.
Browse files Browse the repository at this point in the history
Fixes: #845

Signed-off-by: Victor Makarov <vitja.makarov@gmail.com>
  • Loading branch information
vitek authored and williamcroberts committed Sep 4, 2024
1 parent 50a636b commit 18989a3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -2169,9 +2169,14 @@ static CK_RV dbup_handler_from_7_to_8(sqlite3 *updb) {

/* for each tobject */
CK_ATTRIBUTE_PTR a = attr_get_attribute_by_type(tobj->attrs, CKA_ALLOWED_MECHANISMS);
CK_BYTE type = type_from_ptr(a->pValue, a->ulValueLen);
if (type != TYPE_BYTE_INT_SEQ) {
rv = _db_update_tobject_attrs(updb, tobj->id, tobj->attrs);

if (a) {
CK_BYTE type = type_from_ptr(a->pValue, a->ulValueLen);
if (type != TYPE_BYTE_INT_SEQ) {
rv = _db_update_tobject_attrs(updb, tobj->id, tobj->attrs);
}
} else {
rv = CKR_OK;
}

tobject_free(tobj);
Expand Down

0 comments on commit 18989a3

Please sign in to comment.