mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
util: check for 0 args when applying iptables rule
In normal practice a virFirewallCmd should never have 0 args by the time it gets to the Apply stage, but at some time while debugging one of the other patches in this series, exactly that happened (due to a bug that was since squashed), and having a check for it helped debugging, so let's permanently check for it. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
67362e6328
commit
ad96ee74ce
@ -538,6 +538,12 @@ virFirewallApplyCmd(virFirewall *firewall,
|
||||
if (fwCmd->ignoreErrors)
|
||||
ignoreErrors = fwCmd->ignoreErrors;
|
||||
|
||||
if (fwCmd->argsLen == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Can't apply empty firewall command"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virFirewallApplyCmdDirect(fwCmd, ignoreErrors, &output) < 0)
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user