diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2024-02-22 18:04:57 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2024-04-26 15:16:11 +0300 |
commit | a107887da3c422c25006cadc9328be550123f5a5 (patch) | |
tree | 84a0ca93c4eae9d4c663adc252105c4106ee2445 | |
parent | a05674d72c9089ead4099a10e08769d24da8b0cd (diff) |
helper: cli: fix string length checks
Fix command name and command help string length checks. This allows
one character longer command names and help strings.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | helper/cli.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/helper/cli.c b/helper/cli.c index 4ce4bf62e..dc6491f6b 100644 --- a/helper/cli.c +++ b/helper/cli.c @@ -153,13 +153,13 @@ int odph_cli_register_command(const char *name, odph_cli_user_cmd_func_t func, cmd->fn = func; - if (strlen(name) >= MAX_NAME_LEN - 1) { + if (strlen(name) >= MAX_NAME_LEN) { ODPH_ERR("Error: command name too long\n"); goto error; } strcpy(cmd->name, name); - if (strlen(help) >= MAX_HELP_LEN - 1) { + if (strlen(help) >= MAX_HELP_LEN) { ODPH_ERR("Error: command help too long\n"); goto error; } |