diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-01-26 21:03:56 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-10-30 00:00:15 +0100 |
commit | b5c99ec30eb5fbe46ed3f4d7bf03415132850a30 (patch) | |
tree | 67b39c5ed758a2838d10e15a944072e167c3ecae | |
parent | 58b96645c93395c7a109aa6e43cb5fff2c5b4647 (diff) |
lib/btrfs: avoid NULL-dereference
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>
-rw-r--r-- | lib/btrfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/btrfs.c b/lib/btrfs.c index a2563f7c..03915981 100644 --- a/lib/btrfs.c +++ b/lib/btrfs.c @@ -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; } |