about summary refs log tree commit diff
path: root/third_party/overlays/patches/tpm2-pkcs11-190-dbupgrade.patch
blob: f831c11a80bc5514aae5f9139b8a7a80af725cb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 987323794148a6ff5ce3d02eef8cfeb46bee1761 Mon Sep 17 00:00:00 2001
From: Anton <tracefinder@gmail.com>
Date: Tue, 7 Nov 2023 12:02:15 +0300
Subject: [PATCH] Skip null attribute during DB update

Signed-off-by: Anton <tracefinder@gmail.com>
---
 src/lib/db.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/db.c b/src/lib/db.c
index b4bbd1bf..74c5a7b4 100644
--- a/src/lib/db.c
+++ b/src/lib/db.c
@@ -2169,9 +2169,11 @@ 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);
+            }
         }
 
         tobject_free(tobj);