Sat Jun 29 00:02:11 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
authorRoland McGrath <roland@gnu.org>
Mon, 1 Jul 1996 16:32:03 +0000 (16:32 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 1 Jul 1996 16:32:03 +0000 (16:32 +0000)
* string/strndup.c (strndup): Properly terminate the new
string; add missing second argument to strnlen.
* string/string.h (strndupa): Likewise.

string/strndup.c

index c40d00f..8757b86 100644 (file)
@@ -24,7 +24,7 @@ Cambridge, MA 02139, USA.  */
 char *
 strndup (const char *s, size_t n)
 {
-  size_t len = strnlen (s);
+  size_t len = strnlen (s, n);
   char *new = malloc (len + 1);
 
   if (new == NULL)