Sat Jun 29 00:02:11 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>

* string/strndup.c (strndup): Properly terminate the new
	string; add missing second argument to strnlen.
	* string/string.h (strndupa): Likewise.
This commit is contained in:
Roland McGrath 1996-07-01 16:32:03 +00:00
parent 2baf7c31ad
commit 635eb0b5f5

View File

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