From 8d7d3973224f616ce93cf572d39635f8bcf0b9ad Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 10 Jan 2024 16:00:15 +0100 Subject: [PATCH] test_mx_util: Call mx_call_external with argv != NULL Newer Valgrind versions complain, when `execv()` is called with argv==NULL or with argv[0]==NULL. argv == NULL is not allowed by Posix, but the Linux kernel transforms that into an empty argument list. An empty argument list with argv[0]==NULL does not go against any specs, altough it might confuse programms and led to pkexec being exploitable (CVE-2021-4034) It is not wrong on Linux to call execv() or a wrapper function with argv==NULL, but avoid it anyway to prevent Valgrind warnings. --- test_mx_util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test_mx_util.c b/test_mx_util.c index 4c447d7e..7baa7165 100644 --- a/test_mx_util.c +++ b/test_mx_util.c @@ -597,11 +597,13 @@ static void test_mx_call_external(void) { int sts; errno = 999; - sts = mx_call_external("/usr/bin/true", NULL); + char *argv[] = { "", NULL }; + + sts = mx_call_external("/usr/bin/true", argv); assert(sts == 0); assert(errno == 999); - sts = mx_call_external("/usr/bin/false", NULL); + sts = mx_call_external("/usr/bin/false", argv); assert(sts == -1); assert(errno == EPROTO); }