This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Replace strncpy with memccpy to fix -Wstringop-truncation.


	* nis/nss_nisplus/nisplus-parser.c: Replace strncpy with memcpy to
	avoid -Wstringop-truncation.
---
2018-03-22  Khem Raj  <raj.khem@gmail.com>

        * nis/nss_nisplus/nisplus-parser.c (_nss_nisplus_parse_pwent): Replace
        strncpy with memcpy to avoid -Wstringop-truncation.

 nis/nss_nisplus/nisplus-parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index 8dc021e73d..b53284f889 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -87,7 +87,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
       if (len >= room_left)
 	goto no_more_room;
 
-      strncpy (first_unused, numstr, len);
+      memcpy (first_unused, numstr, len);
       first_unused[len] = '\0';
       numstr = first_unused;
     }
@@ -103,7 +103,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
       if (len >= room_left)
 	goto no_more_room;
 
-      strncpy (first_unused, numstr, len);
+      memcpy (first_unused, numstr, len);
       first_unused[len] = '\0';
       numstr = first_unused;
     }
-- 
2.16.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]