mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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>
This commit is contained in:
parent
05cc758a3d
commit
f69165a8fe
4 changed files with 8 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue