qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] authz-list-file: Fix crash when filename is not set


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 1/3] authz-list-file: Fix crash when filename is not set
Date: Fri, 9 Oct 2020 12:31:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 10/8/20 10:27 PM, Eduardo Habkost wrote:
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>
---
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
---
  authz/listfile.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/authz/listfile.c b/authz/listfile.c
index cd6163aa40..aaf930453d 100644
--- a/authz/listfile.c
+++ b/authz/listfile.c
@@ -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) {


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]