From 0640d99ebfaebe7b455a8bd35fefbb9a93485910 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 16 May 2024 11:03:10 +0200 Subject: [PATCH] test-runner: Fix uninitialised variable usage Error: UNINIT (CWE-457): [#def72] [important] tools/test-runner.c:856:2: var_decl: Declaring variable "argv" without initializer. tools/test-runner.c:945:2: uninit_use: Using uninitialized value "argv[0]". 943| envp[pos] = NULL; 944| 945|-> printf("Running command %s\n", cmdname ? cmdname : argv[0]); 946| 947| pid = fork(); --- tools/test-runner.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/test-runner.c b/tools/test-runner.c index 134e26f9c..ff5e19825 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -912,6 +912,11 @@ static void run_command(char *cmdname, char *home) audio_pid[0] = audio_pid[1] = -1; start_next: + if (!run_auto && !cmdname) { + fprintf(stderr, "Missing command argument\n"); + return; + } + if (run_auto) { if (chdir(home + 5) < 0) { perror("Failed to change home test directory"); -- 2.47.3