• S
    qcow2: avoid memcpy(dst, NULL, len) · 0647d47c
    Stefan Hajnoczi 提交于
    Section "7.1.4 Use of library functions" in the C99 standard says:
    
      If an argument to a function has an invalid value (such as [...]
      a null pointer [...]) [...] the behavior is undefined.
    
    Additionally the "searching and sorting" functions are specified as
    requiring valid pointer values as described in 7.1.4.
    
    This patch fixes the following sanitizer errors:
    
      block/qcow2.c:1807:41: runtime error: null pointer passed as argument 2, which is declared to never be null
      block/qcow2-cluster.c:86:26: runtime error: null pointer passed as argument 2, which is declared to never be null
    Reported-by: NPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: NKevin Wolf <kwolf@redhat.com>
    Message-id: 1473758138-19260-1-git-send-email-stefanha@redhat.com
    Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
    0647d47c
qcow2.c 109.3 KB