diff options
| author | Christian Hopps <chopps@labn.net> | 2025-02-26 13:34:59 +0000 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2025-03-03 15:44:33 +0000 |
| commit | a64ecbadcc83fd1040d9c355cb1bc3a9d03a0fc7 (patch) | |
| tree | 6f0e9acf848f6faf25259e52829b3c1b6bde00c8 /lib/northbound_oper.c | |
| parent | 37893e4421d900eaaab3891b02b7e6b2080c21c6 (diff) | |
lib: nb: fix bug with oper-state query on list data
The capacity of the xpath string was not guaranteed to be sufficient to hold all
the key predicates and so would truncate. Calculate the required space and
guarantee that it is available.
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/northbound_oper.c')
| -rw-r--r-- | lib/northbound_oper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/northbound_oper.c b/lib/northbound_oper.c index 6a3c21b237..bde2228012 100644 --- a/lib/northbound_oper.c +++ b/lib/northbound_oper.c @@ -1492,8 +1492,9 @@ static enum nb_error __walk(struct nb_op_yield_state *ys, bool is_resume) */ len = darr_strlen(ys->xpath); if (ni->keys.num) { - yang_get_key_preds(ys->xpath + len, sib, - &ni->keys, + darr_ensure_avail(ys->xpath, + yang_get_key_pred_strlen(sib, &ni->keys) + 1); + yang_get_key_preds(ys->xpath + len, sib, &ni->keys, darr_cap(ys->xpath) - len); } else { /* add a position predicate (1s based?) */ |
