add implementation of memccpy function