Newer versions of Gcc warn about string truncation.
Fix by using strlcpy.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 tc/m_pedit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 26549eeea899..8577f875a7c0 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;
        }
-- 
2.16.2

Reply via email to