From 2d5377dc4bfac375e26763122e4feb71e4ed7607 Mon Sep 17 00:00:00 2001 From: aled-ua Date: Thu, 9 Jan 2025 11:09:26 +0800 Subject: [PATCH] use H5_IS_BUFFER_OVERFLOW to check overflow --- src/H5Cimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Cimage.c b/src/H5Cimage.c index c0b805a402d..29abb493c6f 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1288,7 +1288,7 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * p = *buf; /* Ensure buffer has enough data for signature comparison */ - if ((size_t)(*buf + H5C__MDCI_BLOCK_SIGNATURE_LEN - p) > cache_ptr->image_len) + if (H5_IS_BUFFER_OVERFLOW(p, H5C__MDCI_BLOCK_SIGNATURE_LEN, *buf + cache_ptr->image_len)) HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, FAIL, "Insufficient buffer size for signature"); /* Check signature */