Skip to content

Commit

Permalink
Fix vuln OSV-2024-390 (#5201)
Browse files Browse the repository at this point in the history
  • Loading branch information
aled-ua authored Jan 3, 2025
1 parent ed082ac commit c0192e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/H5Ocache.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
/* copy the chunk into the image -- this is potentially expensive.
* Can we rework things so that the chunk and the cache share a buffer?
*/
/* Ensure len does not exceed the size of the source buffer */
if (len > chk_proxy->oh->chunk[chk_proxy->chunkno].size)
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "buffer overflow detected");

H5MM_memcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len);

done:
Expand Down

0 comments on commit c0192e2

Please sign in to comment.