[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/20] tests/qtest: Fix potential NULL pointer dereference in qos_
From: |
Paolo Bonzini |
Subject: |
[PULL 13/20] tests/qtest: Fix potential NULL pointer dereference in qos_build_main_args() |
Date: |
Wed, 4 Nov 2020 10:01:46 -0500 |
From: AlexChen <alex.chen@huawei.com>
In qos_build_main_args(), the pointer 'path' is dereferenced before
checking it is valid, which may lead to NULL pointer dereference.
So move the assignment to 'cmd_line' after checking 'path' is valid.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Message-Id: <5FA16ED5.4000203@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/fuzz/qos_fuzz.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c
index b943577b8c..cee1a2a60f 100644
--- a/tests/qtest/fuzz/qos_fuzz.c
+++ b/tests/qtest/fuzz/qos_fuzz.c
@@ -70,7 +70,7 @@ static GString *qos_build_main_args(void)
{
char **path = fuzz_path_vec;
QOSGraphNode *test_node;
- GString *cmd_line = g_string_new(path[0]);
+ GString *cmd_line;
void *test_arg;
if (!path) {
@@ -79,6 +79,7 @@ static GString *qos_build_main_args(void)
}
/* Before test */
+ cmd_line = g_string_new(path[0]);
current_path = path;
test_node = qos_graph_get_node(path[(g_strv_length(path) - 1)]);
test_arg = test_node->u.test.arg;
--
2.26.2
- [PULL 06/20] qtest: add a reproducer for LP#1878642, (continued)
- [PULL 06/20] qtest: add a reproducer for LP#1878642, Paolo Bonzini, 2020/11/04
- [PULL 12/20] configure: fix gio_libs reference, Paolo Bonzini, 2020/11/04
- [PULL 04/20] scripts/oss-fuzz: rename bin/qemu-fuzz-i386, Paolo Bonzini, 2020/11/04
- [PULL 16/20] fuzz: fuzz offsets within pio/mmio regions, Paolo Bonzini, 2020/11/04
- [PULL 08/20] meson: vhost-user-gpu/virtiofsd: use absolute path, Paolo Bonzini, 2020/11/04
- [PULL 05/20] hw/isa/lpc_ich9: Ignore reserved/invalid SCI IRQ, Paolo Bonzini, 2020/11/04
- [PULL 15/20] fuzz: check the MR in the DMA callback, Paolo Bonzini, 2020/11/04
- [PULL 11/20] meson: fix warning for bad sphinx-build, Paolo Bonzini, 2020/11/04
- [PULL 14/20] fuzz: fix writing DMA patterns, Paolo Bonzini, 2020/11/04
- [PULL 17/20] semihosting: fix order of initialization functions, Paolo Bonzini, 2020/11/04
- [PULL 13/20] tests/qtest: Fix potential NULL pointer dereference in qos_build_main_args(),
Paolo Bonzini <=
- [PULL 18/20] qapi, qemu-options: make all parsing visitors parse boolean options the same, Paolo Bonzini, 2020/11/04
- [PULL 20/20] qtest: escape device name in device-introspect-test, Paolo Bonzini, 2020/11/04
- [PULL 19/20] ivshmem-test: do not use short-form boolean option, Paolo Bonzini, 2020/11/04