block: Do not strcmp() with NULL uri->scheme
commitf69165a8feca055cf4a37d13ab0fc5beec3cb372
authorMax Reitz <mreitz@redhat.com>
Tue, 13 Jun 2017 20:57:26 +0000 (13 22:57 +0200)
committerMax Reitz <mreitz@redhat.com>
Mon, 26 Jun 2017 12:54:46 +0000 (26 14:54 +0200)
tree7f9a09b6ed4b50505cae10fb20b5757fec07482a
parent05cc758a3dfc79488d0a8eb7f5830a41871e78d0
block: Do not strcmp() with NULL uri->scheme

uri_parse(...)->scheme may be NULL. In fact, probably every field may be
NULL, and the callers do test this for all of the other fields but not
for scheme (except for block/gluster.c; block/vxhs.c does not access
that field at all).

We can easily fix this by using g_strcmp0() instead of strcmp().

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170613205726.13544-1-mreitz@redhat.com
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/nbd.c
block/nfs.c
block/sheepdog.c
block/ssh.c