]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pager: Do not resolve directories with PATH
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Feb 2026 19:23:45 +0000 (20:23 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Feb 2026 19:27:01 +0000 (20:27 +0100)
If PAGER contains any slash in program part, avoid resolving it with
PATH environment variable. Even if it is found there (in a
subdirectory), sh -c won't execute it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
lib/pager.c

index 9cbf6383f5ea5b27bb97aae5a7770b3a73020497..aec94e2d052fb92ee29879d321f41528a6c580b7 100644 (file)
@@ -136,7 +136,7 @@ static int has_command(const char *cmd)
        if (!b)
                goto cleanup;
 
-       if (*b == '/') {
+       if (strchr(b, '/')) {
                rc = access(b, X_OK) == 0;
                goto cleanup;
        }