On Thu, Sep 03, 2020 at 08:54:08AM -0500, Eric Blake wrote:
On 9/3/20 4:41 AM, Richard W.M. Jones wrote:
Previously with GCC 10.2 this code produced:
In function ‘nbdkit_strndup_intern’, inlined from ‘nbdkit_strdup_intern’ at public.c:839:10: public.c:827:10: error: ‘strndup’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] 827 | copy = strndup (str, n); | ^~~~~~~~~~~~~~~~ --- server/public.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
I find the gcc warning annoying, but this workaround is fine (and potentially even a bit more efficient, because it uses fewer function calls).
ACK, regardless of whether gcc also agrees with your bug report.
Nope they didn't :-( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96916 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org