diff options
author | Max Reitz <mreitz@redhat.com> | 2017-06-13 22:57:26 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-06-26 14:54:46 +0200 |
commit | f69165a8feca055cf4a37d13ab0fc5beec3cb372 (patch) | |
tree | 7f9a09b6ed4b50505cae10fb20b5757fec07482a /block/sheepdog.c | |
parent | 05cc758a3dfc79488d0a8eb7f5830a41871e78d0 (diff) |
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>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index a87ee5facd..08d7b11e9d 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1046,11 +1046,11 @@ static void sd_parse_uri(SheepdogConfig *cfg, const char *filename, } /* transport */ - if (!strcmp(uri->scheme, "sheepdog")) { + if (!g_strcmp0(uri->scheme, "sheepdog")) { is_unix = false; - } else if (!strcmp(uri->scheme, "sheepdog+tcp")) { + } else if (!g_strcmp0(uri->scheme, "sheepdog+tcp")) { is_unix = false; - } else if (!strcmp(uri->scheme, "sheepdog+unix")) { + } else if (!g_strcmp0(uri->scheme, "sheepdog+unix")) { is_unix = true; } else { error_setg(&err, "URI scheme must be 'sheepdog', 'sheepdog+tcp'," |