On 9/3/20 4:59 AM, Richard W.M. Jones wrote:
I just read the response - gcc has a valid point that not all
implementations optimize strndup() to malloc() only strnlen() bytes, but
may attempt to allocate the full size bytes. And malloc(SIZE_MAX) is
going to fail. So we _should_ fix our code: even though it happened to
work on glibc, it is not portable to POSIX
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org