https://gcc.gnu.org/g:0a82c5e1187c68acd5bbe7afa1c2f870a653d369
commit r17-2328-g0a82c5e1187c68acd5bbe7afa1c2f870a653d369 Author: Robert Dubner <[email protected]> Date: Sat Jul 11 00:09:27 2026 -0400 cobol: Use snprintf instead of strncpy in charmaps.cc. This change eliminates compiler warnings about strncpy. libgcobol/ChangeLog: * charmaps.cc (helpful_iconv_open): Use snprintf() instead of strncpy(). Diff: --- libgcobol/charmaps.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgcobol/charmaps.cc b/libgcobol/charmaps.cc index 1fdb9997c097..27f4b8f467d6 100644 --- a/libgcobol/charmaps.cc +++ b/libgcobol/charmaps.cc @@ -1863,8 +1863,8 @@ helpful_iconv_open(const char *tocode, const char *fromcode) char ach_to[32]; char ach_from[32]; - strncpy(ach_to, tocode, sizeof(ach_to)-1); - strncpy(ach_from, fromcode, sizeof(ach_from)-1); + snprintf(ach_to, sizeof ach_to, "%s", tocode); + snprintf(ach_from, sizeof ach_from, "%s", fromcode); fixcode(ach_to, sizeof(ach_to)); fixcode(ach_from, sizeof(ach_from));
