[PATCH v2 1/1] virsh: prevent potential NULL dereference

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

 



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 <d.fedin@xxxxxxxxxxx>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@xxxxxxxxxxxx>
---
 tools/virsh-completer-domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.42.4



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux