aboutsummaryrefslogtreecommitdiff
path: root/block/ssh.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2017-06-13 22:57:26 +0200
committerMax Reitz <mreitz@redhat.com>2017-06-26 14:54:46 +0200
commitf69165a8feca055cf4a37d13ab0fc5beec3cb372 (patch)
tree7f9a09b6ed4b50505cae10fb20b5757fec07482a /block/ssh.c
parent05cc758a3dfc79488d0a8eb7f5830a41871e78d0 (diff)
downloadqemu-arm-f69165a8feca055cf4a37d13ab0fc5beec3cb372.tar.gz
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/ssh.c')
-rw-r--r--block/ssh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/ssh.c b/block/ssh.c
index bac3453c3e..52964416da 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -204,7 +204,7 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
return -EINVAL;
}
- if (strcmp(uri->scheme, "ssh") != 0) {
+ if (g_strcmp0(uri->scheme, "ssh") != 0) {
error_setg(errp, "URI scheme must be 'ssh'");
goto err;
}