aboutsummaryrefslogtreecommitdiff
path: root/src/io/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/io/cli.c')
-rw-r--r--src/io/cli.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/io/cli.c b/src/io/cli.c
index 2ca4b29..14d51f8 100644
--- a/src/io/cli.c
+++ b/src/io/cli.c
@@ -380,7 +380,11 @@ error_t cli_parse(int key, char *arg, struct argp_state *state) {
argp_usage(state);
}
- cfg->bits = strtoul(arg, NULL, 10);
+ char *bits_end = NULL;
+ cfg->bits = strtoul(arg, &bits_end, 10);
+ if (*bits_end != '\0') {
+ argp_failure(state, 1, 0, "Invalid bit size specified.");
+ }
cfg->hex_digits =
2 * (cfg->bits / 8 + (cfg->bits % 8 != 0 ? 1 : 0));
break;