On 9/3/20 4:59 AM, Richard W.M. Jones wrote:

Filed upstream as:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96916

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

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to