@@ -558,6 +558,42 @@ GLIBC232_RAWMEMCHR(m_libc_soname, rawmemchr)
558
558
GLIBC25___STRCPY_CHK (m_libc_soname , __strcpy_chk )
559
559
560
560
561
+ /* mempcpy */
562
+ #define GLIBC25_MEMPCPY (soname , fnname ) \
563
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
564
+ ( void *dst, const void *src, SizeT len ); \
565
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
566
+ ( void *dst, const void *src, SizeT len ) \
567
+ { \
568
+ register char *d; \
569
+ register char *s; \
570
+ SizeT len_saved = len; \
571
+ \
572
+ if (len == 0) \
573
+ return dst; \
574
+ \
575
+ if (is_overlap(dst, src, len, len)) \
576
+ RECORD_OVERLAP_ERROR("mempcpy", dst, src, len); \
577
+ \
578
+ if ( dst > src ) { \
579
+ d = (char *)dst + len - 1; \
580
+ s = (char *)src + len - 1; \
581
+ while ( len-- ) { \
582
+ *d-- = *s--; \
583
+ } \
584
+ } else if ( dst < src ) { \
585
+ d = (char *)dst; \
586
+ s = (char *)src; \
587
+ while ( len-- ) { \
588
+ *d++ = *s++; \
589
+ } \
590
+ } \
591
+ return (void*)( ((char*)dst) + len_saved ); \
592
+ }
593
+
594
+ GLIBC25_MEMPCPY (m_libc_soname , mempcpy )
595
+
596
+
561
597
/*------------------------------------------------------------*/
562
598
/*--- AIX stuff only after this point ---*/
563
599
/*------------------------------------------------------------*/
0 commit comments