fix(cli): buffer overflow

add 1 to PING_OPTSTR_LEN for the \0
This commit is contained in:
lohhiiccc 2026-03-16 11:24:37 -05:00
parent 25116a7787
commit cdc4df4f85

View file

@ -110,7 +110,7 @@ enum { PING_OPT_LEN = (0 PING_OPTIONS_LIST) };
+ (1 * (has_arg == no_argument) \ + (1 * (has_arg == no_argument) \
+ (2 * (has_arg == required_argument) \ + (2 * (has_arg == required_argument) \
+ (3 * (has_arg == optional_argument)))) + (3 * (has_arg == optional_argument))))
enum { PING_OPTSTR_LEN = (1 PING_OPTIONS_LIST) }; enum { PING_OPTSTR_LEN = (2 PING_OPTIONS_LIST) };
/* +1 for ':' to disable getopt error messages */ /* +2 for ':' to disable getopt error messages and \0 */
#endif #endif