aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0029-Replace-strncpy-with-memccpy-to-fix-Wstringop-trunca.patch
blob: fa29f4165b86ebdb98795ad440dd3340b50806bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 113e0516fbd3ce18253f0423762416d4c4b38fb0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 22 Mar 2018 17:57:37 -0700
Subject: [PATCH 29/29] Replace strncpy with memccpy to fix
 -Wstringop-truncation.

	* nis/nss_nisplus/nisplus-parser.c: Replace strncpy with memcpy to
	avoid -Wstringop-truncation.
---
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Submitted [https://sourceware.org/ml/libc-alpha/2018-03/msg00531.html]

 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