summaryrefslogtreecommitdiffstats
path: root/src/H5MM.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5MM.c')
-rw-r--r--src/H5MM.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/H5MM.c b/src/H5MM.c
index 9e87a2d..6f65e06 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -568,7 +568,8 @@ H5MM_xfree(void *mem)
/*-------------------------------------------------------------------------
* Function: H5MM_memcpy
*
- * Purpose: Like memcpy(3) but with a check for buffer overlap.
+ * Purpose: Like memcpy(3) but with sanity checks on the parameters,
+ * particularly buffer overlap.
*
* Return: Success: pointer to dest
* Failure: NULL
@@ -588,7 +589,8 @@ H5MM_memcpy(void *dest, const void *src, size_t n)
HDassert(dest);
HDassert(src);
- HDassert(dest >= src + n || src >= dest + n);
+ HDassert(n > 0);
+ HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n);
ret = HDmemcpy(dest, src, n);