vg_mylibc:VG_(strncpy)() behaves dubiously -- it can write a
'\0' past the end of the given array.
Possibly accounting for some strange behaviour in the g++3 demangler?
git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_1_0_BRANCH@613
void VG_(strncpy) ( Char* dest, const Char* src, Int ndest )
{
- VG_(strncpy_safely)( dest, src, ndest+1 );
+ Int i = 0;
+ while (True) {
+ if (src[i] == 0) return;
+ if (i >= ndest) return;
+ dest[i] = src[i];
+ i++;
+ }
}