[BlueZ 06/15] test-runner: Fix uninitialised variable usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Error: UNINIT (CWE-457): [#def72] [important]
bluez-5.75/tools/test-runner.c:856:2: var_decl: Declaring variable "argv" without initializer.
bluez-5.75/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 134e26f9c691..ff5e19825801 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.44.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux