From 33cd5149f8c9399efdb60f3d4f1ed2d0779a74a7 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 6 Jul 2016 13:03:21 +0200 Subject: [PATCH] cli: do not skip over a nonexistent argument in nmc_do_cmd() If we're called without an argument, don't shift arguments of the callback -- it would be called with argc==-1. --- clients/cli/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/cli/common.c b/clients/cli/common.c index 7ac0a7625..214eb7eb9 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -1445,7 +1445,7 @@ nmc_do_cmd (NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, char } } else if (c->func) { /* No command, run the default handler. */ - nmc->return_value = c->func (nmc, argc-1, argv+1); + nmc->return_value = c->func (nmc, argc, argv); } else { /* No command and no default handler. */ g_string_printf (nmc->return_text, _("Error: missing argument. Try passing --help."));