Merge pull request #13578 from opensourcerouting/fix/ripd_argv_find

ripd: Use argv_find to avoid buffer overflow when parsing allow-ecmp args
This commit is contained in:
Russ White 2023-05-23 08:20:07 -04:00 committed by GitHub
commit 5db30e7958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,11 +91,11 @@ DEFUN_YANG (rip_allow_ecmp,
"Allow Equal Cost MultiPath\n"
"Number of paths\n")
{
int idx_number = 1;
int idx_number = 0;
char mpaths[3] = {};
uint32_t paths = MULTIPATH_NUM;
if (argv[idx_number])
if (argv_find(argv, argc, CMD_RANGE_STR(1, MULTIPATH_NUM), &idx_number))
paths = strtol(argv[idx_number]->arg, NULL, 10);
snprintf(mpaths, sizeof(mpaths), "%u", paths);