From cdc4df4f856e75f3234e0de665ce292a14b6e8e2 Mon Sep 17 00:00:00 2001 From: lohhiiccc <96543753+lohhiiccc@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:24:37 -0500 Subject: [PATCH] fix(cli): buffer overflow add 1 to PING_OPTSTR_LEN for the \0 --- includes/internal/cli/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/internal/cli/options.h b/includes/internal/cli/options.h index 5fdc8d3..0d86ad7 100644 --- a/includes/internal/cli/options.h +++ b/includes/internal/cli/options.h @@ -110,7 +110,7 @@ enum { PING_OPT_LEN = (0 PING_OPTIONS_LIST) }; + (1 * (has_arg == no_argument) \ + (2 * (has_arg == required_argument) \ + (3 * (has_arg == optional_argument)))) -enum { PING_OPTSTR_LEN = (1 PING_OPTIONS_LIST) }; -/* +1 for ':' to disable getopt error messages */ +enum { PING_OPTSTR_LEN = (2 PING_OPTIONS_LIST) }; +/* +2 for ':' to disable getopt error messages and \0 */ #endif