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:
parent
2baf7c31ad
commit
635eb0b5f5
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user