Skip to content

Commit

Permalink
Fix the last valid byte in buf
Browse files Browse the repository at this point in the history
  • Loading branch information
aled-ua authored Jan 15, 2025
1 parent 64568ea commit 79e7168
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/H5Cimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,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 (H5_IS_BUFFER_OVERFLOW(p, H5C__MDCI_BLOCK_SIGNATURE_LEN, *buf + buf_size))
if (H5_IS_BUFFER_OVERFLOW(p, H5C__MDCI_BLOCK_SIGNATURE_LEN, *buf + buf_size - 1))
HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, FAIL, "Insufficient buffer size for signature");

/* Check signature */
Expand Down

0 comments on commit 79e7168

Please sign in to comment.