From abcf85e98300762e4f31953cecf635ab182ef859 Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Thu, 15 Jul 2021 14:43:22 +0200 Subject: [PATCH] fix order of tests to avoid strstr on NULL value --- src/manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manager.c b/src/manager.c index 64f4d244..8a229d09 100644 --- a/src/manager.c +++ b/src/manager.c @@ -1123,7 +1123,7 @@ main(int argc, char **argv) if (workdir == NULL || strlen(workdir) == 0) { workdir = pw->pw_dir; // If home dir is still not defined or set to nologin/nonexistent, fall back to /tmp - if (strstr(workdir, "nologin") || strstr(workdir, "nonexistent") || workdir == NULL || strlen(workdir) == 0) { + if (workdir == NULL || strlen(workdir) == 0 || strstr(workdir, "nologin") || strstr(workdir, "nonexistent")) { workdir = "/tmp"; }