Hi,
In memcpy_s there is a guard in place to prevent copying overlapping ranges (which is UB). However, the way the check is implemented it will trigger UB in all other cases. Comparing pointers from two separately allocated objects is forbidden as per 6.5.8 C11 except when using (in)equality. I suggest using a cast to uintptr_t as seen in mem_prim_move.
Best,
Fabian
/edit: Accidentally wrote memset_s at first.