about summary refs log tree commit diff
path: root/string/bits/string2.h
diff options
context:
space:
mode:
Diffstat (limited to 'string/bits/string2.h')
-rw-r--r--string/bits/string2.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/string/bits/string2.h b/string/bits/string2.h
index aafb578915..e8ac063e03 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -1216,7 +1216,7 @@ extern char *__strndup (__const char *__string, size_t __n)
 			  size_t __n = (n);				      \
 			  char *__retval;				      \
 			  if (__n < __len)				      \
-			    __len = __n;				      \
+			    __len = __n + 1;				      \
 			  __retval = (char *) malloc (__len);		      \
 			  if (__retval != NULL)				      \
 			    {						      \