summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-07-15 16:37:26 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-07-16 10:16:32 +0300
commit2a25a595ce90e95edd2a4127a8c7f320d94ddaaf (patch)
treeef5553d980d48b9e72d932a84eed39879dc17783
parent34162d01fd781e1d19620def3080c415bdb609e0 (diff)
downloadapk-tools-2a25a595ce90e95edd2a4127a8c7f320d94ddaaf.tar.gz
apk-tools-2a25a595ce90e95edd2a4127a8c7f320d94ddaaf.tar.bz2
apk-tools-2a25a595ce90e95edd2a4127a8c7f320d94ddaaf.tar.xz
apk-tools-2a25a595ce90e95edd2a4127a8c7f320d94ddaaf.zip
check trust in adb_trust_write_signatures()
Based on patch from Daniel Golle <daniel@makrotopia.org>
-rw-r--r--src/adb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/adb.c b/src/adb.c
index a7401a0..77ceb63 100644
--- a/src/adb.c
+++ b/src/adb.c
@@ -973,7 +973,7 @@ int adb_c_adb(struct apk_ostream *os, struct adb *db, struct apk_trust *t)
adb_c_header(os, db);
adb_c_block(os, ADB_BLOCK_ADB, db->adb);
- if (t) adb_trust_write_signatures(t, db, NULL, os);
+ adb_trust_write_signatures(t, db, NULL, os);
return apk_ostream_error(os);
}
@@ -1032,6 +1032,8 @@ int adb_trust_write_signatures(struct apk_trust *trust, struct adb *db, struct a
size_t siglen;
int r;
+ if (IS_ERR_OR_NULL(trust)) return PTR_ERR(trust);
+
if (!vfy) {
vfy = alloca(sizeof *vfy);
memset(vfy, 0, sizeof *vfy);