• E
    libvirt-<module>: Check caller-provided buffers to be NULL with size > 0 · d6064e27
    Erik Skultety 提交于
    Pre-Glib era which used malloc allowed the size of the client-side
    buffers to be declared as 0, because malloc documents that it can either
    return 0 or a unique pointer on 0 size allocations.
    With glib this doesn't work anymore, because glib documents that for
    such allocation requests NULL is always returned which results in an
    error in our public API checks server-side.
    This patch complements the fix in the RPC layer by explicitly erroring
    out on the following combination of args used by our legacy APIs (their
    moder equivalents don't suffer from this):
    
    function(caller-allocated-array, size, ...) {
        if (!caller-allocated-array && size > 0)
            return error;
    }
    
    treating everything else as a valid input and potentially let that fail
    on the server-side rather than client-side.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1772842Signed-off-by: NErik Skultety <eskultet@redhat.com>
    Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
    d6064e27
libvirt-nwfilter.c 21.7 KB