]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/btrfs: avoid NULL-dereference
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 26 Jan 2023 20:03:56 +0000 (21:03 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sun, 29 Oct 2023 23:00:15 +0000 (00:00 +0100)
    btrfs.c:42:13: warning: use of NULL 'cmd' where non-null expected [CWE-476] [-Wanalyzer-null-argument]

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 54ab542887994f8b6e5411469d6867e3a2e58800
Link: <https://github.com/shadow-maint/shadow/pull/770>
Reviewed-by: Michael Vetter <jubalh@iodoru.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/btrfs.c

index a2563f7c359c3aae73e4e8e012a3cab898194a42..03915981cfff2b44313e6ec69fe209e85b2c1d8f 100644 (file)
@@ -39,7 +39,7 @@ static int run_btrfs_subvolume_cmd(const char *subcmd, const char *arg1, const c
                NULL
        };
 
-       if (access(cmd, X_OK)) {
+       if (!cmd || access(cmd, X_OK)) {
                return 1;
        }