From efb9c2ad06b63171749af29b5d781b8250f96b1e Mon Sep 17 00:00:00 2001 From: Stefans Mezulis Date: Fri, 9 Nov 2018 16:13:45 +0000 Subject: [PATCH] #33: Fix benign compiler warning Prefer `strcpy` rather than `strncpy` when the destination array bounds have already been checked. This avoids the spurious compiler warning `stringop-truncation`. --- src/cpipes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpipes.c b/src/cpipes.c index c46bea9..1370c61 100644 --- a/src/cpipes.c +++ b/src/cpipes.c @@ -132,7 +132,7 @@ int init_chars(void) { char *term_charset = nl_langinfo(CODESET); char inbuf[CHAR_BUF_SZ]; char utf8buf[CHAR_BUF_SZ]; - strncpy(inbuf, selected_chars, CHAR_BUF_SZ); + strcpy(inbuf, selected_chars); X(locale_to_utf8(inbuf, utf8buf, source_charset, CHAR_BUF_SZ)); X(utf8_to_locale(utf8buf, pipe_char_buf, CHAR_BUF_SZ, term_charset,