EMS/kit/kit_safe_memcpy.c

9 lines
241 B
C

#include <string.h>
#include <errno.h>
int memcpy_s(void *dest, size_t dest_size, const void *src, size_t count) {
if (!dest || !src) return EINVAL;
if (count > dest_size) return ERANGE;
memcpy(dest, src, count);
return 0;
}