From: Alexander Kuznetsov Date: Mon, 14 Apr 2025 13:32:10 +0000 (+0300) Subject: virsh: prevent potential NULL dereference X-Git-Tag: v11.3.0-rc1~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ccd9676a8fe074e64eb9ba55a521e8ff2ecfe5a;p=thirdparty%2Flibvirt.git virsh: prevent potential NULL dereference virXPathString() can return NULL so we need to use STRNEQ_NULLABLE here Found by Linux Verification Center (linuxtesting.org) with Svace. Reported-by: Dmitry Fedin Signed-off-by: Alexander Kuznetsov Reviewed-by: Michal Privoznik --- diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 0a3a113dca..b6a4d85ee8 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -891,7 +891,7 @@ virshDomainConsoleCompleter(vshControl *ctl, ctxt->node = parallels[i - nserials]; type = virXPathString("string(./@type)", ctxt); - if (STRNEQ(type, "pty")) + if (STRNEQ_NULLABLE(type, "pty")) continue; tmp[offset++] = virXPathString("string(./alias/@name)", ctxt);