From: Jim Fehlig <[email protected]> #0 vshPrintStderr (ctl=0x0, level=4, format=<optimized out>, ap=<optimized out>) at ../tools/vsh.c:2148 #1 0x00005555555e6b2c in vshError (ctl=ctl@entry=0x0, format=<optimized out>) at ../tools/vsh.c:2170 #2 0x00005555555afec7 in virshFindDisk (doc=doc@entry=0x555555696ee0 "<domain type='kvm' id='1'>\n <name>test</name>\n <uuid>9b27a21e-dfa2-4c1e-9d11-2de275aefb03</uuid>\n <metadata>\n <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1."..., path=0x555555651240 "vdz", type=type@entry=0) at ../tools/virsh-domain.c:13055 #3 0x00005555555b0151 in cmdDetachDisk (ctl=0x7fffffffdac0, cmd=0x5555556914c0) at ../tools/virsh-domain.c:13231 #4 0x00005555555e6ddb in vshCommandRun (ctl=ctl@entry=0x7fffffffdac0, cmd=0x5555556914c0) at ../tools/vsh.c:1383 #5 0x000055555559347a in main (argc=<optimized out>, argv=0x7fffffffdeb8) at ../tools/virsh.c:908
Ensure 'ctl' is valid before dereferencing it. Fixes: 9899c91515d79595d19800ccc895df18eb7bb3f7 Signed-off-by: Jim Fehlig <[email protected]> --- tools/vsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index ccf2f21d64..667cc1a0d2 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2145,7 +2145,7 @@ vshPrintStderr(vshControl *ctl, if (ctl) vshOutputLogFile(ctl, level, str); - if (ctl->stderr_closed) + if (ctl && ctl->stderr_closed) return; /* Most output is to stdout, but if someone ran virsh 2>&1, then -- 2.51.0
