pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41709?usp=email )

Change subject: vty: assert in optional param followed by optional-multi-choice 
param: Fix [2/2]
......................................................................

vty: assert in optional param followed by optional-multi-choice param: Fix [2/2]

in cmd_make_descr, cp during the asserting iteration looks like this:
(gdb) print cp
$18 = 0x555555c1939d ") [(one|two|three)"

As a result, first multiple is set to 0 and later on logic was missing
for this specific case.

Change-Id: I4c184db53bec28ab42bcd45e033733d850eea5d2
Fixes: b55f4d2df21b966c3953264d8961f259814f4650
Related: OS#6360
(cherry picked from commit 2e41c4301ece14cbd9d22896a079619ba080200a)
---
M src/vty/command.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, approved




diff --git a/src/vty/command.c b/src/vty/command.c
index 8594290..c1bda8a 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -443,6 +443,12 @@
                while (isspace((int)*cp) && *cp != '\0')
                        cp++;

+               /* Explicitly detect optional multi-choice braces like 
[(one|two)]. */
+               if (cp[0] == '[' && cp[1] == '(') {
+                       optional_brace = 1;
+                       cp++;
+               }
+
                if (*cp == '(') {
                        multiple = 1;
                        cp++;

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41709?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: pespin/rel-1.12.0
Gerrit-Change-Id: I4c184db53bec28ab42bcd45e033733d850eea5d2
Gerrit-Change-Number: 41709
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to