From 2ef79bcc09ce50dd34a8353461f94b8145fcdc70 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Mon, 10 Feb 2020 13:18:47 +0100 Subject: [PATCH] lib/util_hash.c: change asserts to allow at least X buffer length --- lib/util_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util_hash.c b/lib/util_hash.c index 5a863f3d..3a8285b2 100644 --- a/lib/util_hash.c +++ b/lib/util_hash.c @@ -116,7 +116,7 @@ xbps_file_sha256_raw(unsigned char *dst, size_t dstlen, const char *file) char buf[65536]; SHA256_CTX sha256; - assert(dstlen == SHA256_DIGEST_LENGTH); + assert(dstlen >= SHA256_DIGEST_LENGTH); if ((fd = open(file, O_RDONLY)) < 0) return false; @@ -141,7 +141,7 @@ xbps_file_sha256(char *dst, size_t dstlen, const char *file) { unsigned char digest[XBPS_SHA256_DIGEST_SIZE]; - assert(dstlen == XBPS_SHA256_SIZE); + assert(dstlen >= XBPS_SHA256_SIZE); if (!xbps_file_sha256_raw(digest, sizeof digest, file)) return false;