Re: [PATCH 4/5] virsh: Resolve possible NULL dereference

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

 



On 02/14/13 17:42, John Ferlan wrote:
Coverity found that commit '41b5e845' had a possible NULL dereference on
arg->data processing
---
  tools/virsh.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 4f75e8e..f5a01b3 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1,7 +1,7 @@
  /*
   * virsh.c: a shell to exercise the libvirt API
   *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
@@ -1475,7 +1475,7 @@ vshCommandOptStringReq(vshControl *ctl,
      if (!arg->data)
          error = N_("Programming error: Requested option is a boolean");

-    if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK))
+    if (arg->data && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK))

Ah, yeah, that assignment doesn't skip this condition. I missed that while writing it.

          error = N_("Option argument is empty");

      if (error) {


ACK.

Peter

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]