Skip to content

Commit 135286b

Browse files
committed
Fix vuln OSV-2024-390
1 parent 966454a commit 135286b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/H5Ocache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,11 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing)
864864
HDassert(chk_proxy->cache_info.type == H5AC_OHDR_CHK);
865865
HDassert(chk_proxy->oh);
866866
HDassert(chk_proxy->oh->chunk[chk_proxy->chunkno].size == len);
867+
/* Ensure len does not exceed the size of the source buffer */
868+
if (len > chk_proxy->oh->chunk[chk_proxy->chunkno].size) {
869+
HDfprintf(stderr, "Buffer overflow detected during chunk serialization\n");
870+
goto done;
871+
}
867872

868873
/* Serialize messages for this chunk */
869874
if (H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0)

0 commit comments

Comments
 (0)