]> git.proxmox.com Git - mirror_qemu.git/commitdiff
authz-list-file: Fix crash when filename is not set
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 8 Oct 2020 20:27:11 +0000 (16:27 -0400)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 13 Oct 2020 19:56:30 +0000 (15:56 -0400)
Fix the following crash:

  $ qemu-system-x86_64 -object authz-list-file,id=obj0
  qemu-system-x86_64: -object authz-list-file,id=obj0: GLib: g_file_get_contents: assertion 'filename != NULL' failed
  Segmentation fault (core dumped)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-Id: <20201008202713.1416823-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
authz/listfile.c

index cd6163aa406a3930b1b36c3c5bf133ea750cc141..aaf930453d217553fdada5fa815243e2784e8543 100644 (file)
@@ -122,6 +122,11 @@ qauthz_list_file_complete(UserCreatable *uc, Error **errp)
     QAuthZListFile *fauthz = QAUTHZ_LIST_FILE(uc);
     gchar *dir = NULL, *file = NULL;
 
+    if (!fauthz->filename) {
+        error_setg(errp, "filename not provided");
+        return;
+    }
+
     fauthz->list = qauthz_list_file_load(fauthz, errp);
 
     if (!fauthz->refresh) {