From: John Ferlan Date: Wed, 13 Feb 2013 12:49:29 +0000 (-0500) Subject: virsh: Resolve possible NULL dereference X-Git-Tag: v1.0.3-rc1~97 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d816219eb04c045ed5e08f0707f470997875aeb;p=thirdparty%2Flibvirt.git virsh: Resolve possible NULL dereference Coverity found that commit '41b5e845' had a possible NULL dereference on arg->data processing --- diff --git a/tools/virsh.c b/tools/virsh.c index 4f75e8ef94..f5a01b3d5b 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)) error = N_("Option argument is empty"); if (error) {