From e495212d229d58eb4d70c94d7f828a04c386c3b2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 4 Jan 2017 23:47:07 +1030 Subject: Sync libiberty from gcc Picks up copyright year update and other recent fixes. --- libiberty/xstrndup.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libiberty/xstrndup.c') diff --git a/libiberty/xstrndup.c b/libiberty/xstrndup.c index 0a41f60..53f4451 100644 --- a/libiberty/xstrndup.c +++ b/libiberty/xstrndup.c @@ -1,5 +1,5 @@ /* Implement the xstrndup function. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005-2017 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. @@ -48,10 +48,7 @@ char * xstrndup (const char *s, size_t n) { char *result; - size_t len = strlen (s); - - if (n < len) - len = n; + size_t len = strnlen (s, n); result = XNEWVEC (char, len + 1); -- cgit v1.1