This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
ToT build failure with ToT GCC (strncpy warning)
- From: Steve Ellcey <sellcey at cavium dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Date: Mon, 13 Nov 2017 08:28:58 -0800
- Subject: ToT build failure with ToT GCC (strncpy warning)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
A recent change to GCC has caused a glibc build failure. The GCC
change was for strncpy buffer overflow checking (PR c/81117 in the GCC
bugzilla). The resulting glibc build failure is:
../sysdeps/unix/sysv/linux/if_index.c:46:3: error: ‘strncpy’ specified
bound 16 equals destination size [-Werror=stringop-truncation]
strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It looks like GCC ran into this themselves and their fix was to change
the strncpy call to memcpy. The glibc breakage is also noted in GCC
bug bootstrap/82948 but I don't see it mentioned in the glibc mailing
lsit anywhere.
Does changing the strncpy call here to memcpy sound like the right fix?
Steve Ellcey
sellcey@cavium.com