summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/machine/spu/strncpy.c5
1 files changed, 5 insertions, 0 deletions
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));