diff options
Diffstat (limited to 'string/strxfrm.c')
-rw-r--r-- | string/strxfrm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c index dd0ad67835..b655daf9e4 100644 --- a/string/strxfrm.c +++ b/string/strxfrm.c @@ -22,6 +22,7 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> +#include <sys/param.h> #ifndef STRING_TYPE # define STRING_TYPE char @@ -124,7 +125,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l) if (nrules == 0) { if (n != 0) - STPNCPY (dest, src, n); + STPNCPY (dest, src, MIN (srclen + 1, n)); return srclen; } |