]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virFindFileInPath: Don't pass NULL to g_canonicalize_filename()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Jun 2021 16:01:37 +0000 (18:01 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Jun 2021 19:14:03 +0000 (21:14 +0200)
If given file is not found in $PATH then g_find_program_in_path()
returns NULL. However, g_canonicalize_filename() does not accept
NULL as input.

Fixes: 65c2901906b5e2d707f9184ff3719a5375bab427
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virfile.c

index c3022025735b38a11686a0425d4aff381ccddfb3..4f98b011be67b6960b94c79c806d1d89adc2661d 100644 (file)
@@ -1667,6 +1667,8 @@ virFindFileInPath(const char *file)
         return NULL;
 
     path = g_find_program_in_path(file);
+    if (!path)
+        return NULL;
 
     /* Workaround for a bug in g_find_program_in_path() not returning absolute
      * path as documented.  This has been fixed in