Commit 6334f553 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't rely on unsigned -1 to be huge

parent fc1c056a
...@@ -206,11 +206,12 @@ VCLS_func_help_json(struct cli *cli, const char * const *av, void *priv) ...@@ -206,11 +206,12 @@ VCLS_func_help_json(struct cli *cli, const char * const *av, void *priv)
static void static void
cls_dispatch(struct cli *cli, const struct cli_proto *cp, cls_dispatch(struct cli *cli, const struct cli_proto *cp,
char * const * av, unsigned ac) char * const * av, int ac)
{ {
int json = 0; int json = 0;
AN(av); AN(av);
assert(ac >= 0);
VSB_clear(cli->sb); VSB_clear(cli->sb);
...@@ -234,7 +235,7 @@ cls_dispatch(struct cli *cli, const struct cli_proto *cp, ...@@ -234,7 +235,7 @@ cls_dispatch(struct cli *cli, const struct cli_proto *cp,
return; return;
} }
if (ac - 1 > cp->desc->maxarg + json) { if (cp->desc->maxarg >= 0 && ac - 1 > cp->desc->maxarg + json) {
VCLI_Out(cli, "Too many parameters\n"); VCLI_Out(cli, "Too many parameters\n");
VCLI_SetResult(cli, CLIS_TOOMANY); VCLI_SetResult(cli, CLIS_TOOMANY);
return; return;
...@@ -257,7 +258,7 @@ cls_exec(struct VCLS_fd *cfd, char * const *av) ...@@ -257,7 +258,7 @@ cls_exec(struct VCLS_fd *cfd, char * const *av)
struct VCLS *cs; struct VCLS *cs;
struct cli_proto *clp; struct cli_proto *clp;
struct cli *cli; struct cli *cli;
unsigned na; int na;
ssize_t len; ssize_t len;
char *s; char *s;
unsigned lim; unsigned lim;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment