]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Resolve possible NULL dereference
authorJohn Ferlan <jferlan@redhat.com>
Wed, 13 Feb 2013 12:49:29 +0000 (07:49 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 16 Feb 2013 12:44:35 +0000 (07:44 -0500)
Coverity found that commit '41b5e845' had a possible NULL dereference on
arg->data processing

tools/virsh.c

index 4f75e8ef94fefe1dbfd12bfe1d94fc6005e67934..f5a01b3d5bfba6580f1961c38187a73f92bb1cab 100644 (file)
@@ -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))
         error = N_("Option argument is empty");
 
     if (error) {