summaryrefslogtreecommitdiff
path: root/string/strxfrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/strxfrm.c')
-rw-r--r--string/strxfrm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c
index 513a4b6a1a..e40ae1c433 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -32,5 +32,8 @@ strxfrm (dest, src, n)
const char *src;
size_t n;
{
+ if (n == 0)
+ return strlen (src);
+
return __stpncpy (dest, src, n) - dest;
}