summaryrefslogtreecommitdiff
path: root/src/apk_crypto.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-09-03 16:29:55 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-10-27 16:14:45 +0300
commit40f08663679246edaa578d87e9f153adaad62a87 (patch)
treefb7752c055af85656af4f5a3324d795efbdaf642 /src/apk_crypto.h
parent9bd1e95e5be92e9db3e0f59e3920105c2f578846 (diff)
downloadapk-tools-40f08663679246edaa578d87e9f153adaad62a87.tar.gz
apk-tools-40f08663679246edaa578d87e9f153adaad62a87.tar.bz2
apk-tools-40f08663679246edaa578d87e9f153adaad62a87.tar.xz
apk-tools-40f08663679246edaa578d87e9f153adaad62a87.zip
db, add: support adding v3 package files
Diffstat (limited to 'src/apk_crypto.h')
-rw-r--r--src/apk_crypto.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/apk_crypto.h b/src/apk_crypto.h
index 4eab130..43b4bd2 100644
--- a/src/apk_crypto.h
+++ b/src/apk_crypto.h
@@ -120,8 +120,12 @@ static inline int apk_digest_cmp_csum(const struct apk_digest *d, const struct a
}
static inline void apk_checksum_from_digest(struct apk_checksum *csum, const struct apk_digest *d)
{
- csum->type = d->len;
- memcpy(csum->data, d->data, d->len);
+ if (d->len > sizeof csum->data) {
+ csum->type = APK_CHECKSUM_NONE;
+ } else {
+ csum->type = d->len;
+ memcpy(csum->data, d->data, d->len);
+ }
}
// Asymmetric keys