From: Stephen Hemminger Date: Mon, 19 Mar 2018 16:43:33 +0000 (-0700) Subject: pedit: fix strncpy warning X-Git-Tag: v4.16.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95744efac4ffdbb9b625aedd41cd6c5636189cfe;p=thirdparty%2Fiproute2.git pedit: fix strncpy warning Newer versions of Gcc warn about string truncation. Fix by using strlcpy. Signed-off-by: Stephen Hemminger --- diff --git a/tc/m_pedit.c b/tc/m_pedit.c index 26549eeea..8577f875a 100644 --- a/tc/m_pedit.c +++ b/tc/m_pedit.c @@ -111,7 +111,7 @@ reg: noexist: p = calloc(1, sizeof(*p)); if (p) { - strncpy(p->id, str, sizeof(p->id) - 1); + strlcpy(p->id, str, sizeof(p->id)); p->parse_peopt = pedit_parse_nopopt; goto reg; }