summaryrefslogtreecommitdiff
path: root/src/apk_blob.h
diff options
context:
space:
mode:
authorReid Rankin <reidrankin@gmail.com>2020-01-24 15:13:43 +0000
committerTimo Teräs <timo.teras@iki.fi>2020-01-25 16:35:31 +0200
commitc7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32 (patch)
treebb94450c834758b00517248cdf7d7ca798ab3194 /src/apk_blob.h
parentaa882df5116df56d95b3750c28fab5013b680c7a (diff)
downloadapk-tools-c7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32.tar.gz
apk-tools-c7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32.tar.bz2
apk-tools-c7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32.tar.xz
apk-tools-c7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32.zip
don't use hardcoded checksum buffer sizes
Diffstat (limited to 'src/apk_blob.h')
-rw-r--r--src/apk_blob.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/apk_blob.h b/src/apk_blob.h
index c14980d..91ba9b3 100644
--- a/src/apk_blob.h
+++ b/src/apk_blob.h
@@ -36,12 +36,15 @@ extern apk_blob_t apk_null_blob;
#define APK_CHECKSUM_MD5 16
#define APK_CHECKSUM_SHA1 20
#define APK_CHECKSUM_DEFAULT APK_CHECKSUM_SHA1
+#define APK_CHECKSUM_MAX APK_CHECKSUM_SHA1
-#define APK_BLOB_CHECKSUM_BUF 34
+/* Enough space for a hexdump of the longest checksum possible plus
+ * a two-character type prefix */
+#define APK_BLOB_CHECKSUM_BUF (2 + (2 * APK_CHECKSUM_MAX))
-/* Internal cointainer for MD5 or SHA1 */
+/* Internal container for checksums */
struct apk_checksum {
- unsigned char data[20];
+ unsigned char data[APK_CHECKSUM_MAX];
unsigned char type;
};