diff options
author | Reid Rankin <reidrankin@gmail.com> | 2020-01-24 15:13:43 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-01-25 16:35:31 +0200 |
commit | c7c8ab7c574d9c4360daf41bc0a7e6ac78da0f32 (patch) | |
tree | bb94450c834758b00517248cdf7d7ca798ab3194 /src/apk_blob.h | |
parent | aa882df5116df56d95b3750c28fab5013b680c7a (diff) | |
download | apk-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.h | 9 |
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; }; |