diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 119c0a6be..4be46540d 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,7 @@ +2006-12-04 Kazunori Asayama + + * libc/machine/spu/strncpy.c: Add padding. + 2006-12-04 Kazunori Asayama * testsuite/newlib.string/tstring.c: diff --git a/newlib/libc/machine/spu/strncpy.c b/newlib/libc/machine/spu/strncpy.c index 5e6169f32..334c3bb6c 100644 --- a/newlib/libc/machine/spu/strncpy.c +++ b/newlib/libc/machine/spu/strncpy.c @@ -76,6 +76,11 @@ char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n */ len = spu_extract(spu_sel(spu_promote((unsigned int)len, 0), N, gt), 0); + /* Padding + */ + if (len != n) { + memset(dest + len, 0, n - len); + } /* Perform a memcpy of the resulting length */ return ((char *)memcpy((void *)dest, (const void *)src, len));