summaryrefslogtreecommitdiff
path: root/lib/yang.h
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2025-02-26 13:34:59 +0000
committerChristian Hopps <chopps@labn.net>2025-03-03 15:44:33 +0000
commita64ecbadcc83fd1040d9c355cb1bc3a9d03a0fc7 (patch)
tree6f0e9acf848f6faf25259e52829b3c1b6bde00c8 /lib/yang.h
parent37893e4421d900eaaab3891b02b7e6b2080c21c6 (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/yang.h')
-rw-r--r--lib/yang.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/yang.h b/lib/yang.h
index 748f089037..afad0023ad 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -879,7 +879,11 @@ bool yang_is_last_level_dnode(const struct lyd_node *dnode);
/* Create a YANG predicate string based on the keys */
extern int yang_get_key_preds(char *s, const struct lysc_node *snode,
- struct yang_list_keys *keys, ssize_t space);
+ const struct yang_list_keys *keys, ssize_t space);
+
+/* Get the length of the predicate string based on the keys */
+extern int yang_get_key_pred_strlen(const struct lysc_node *snode,
+ const struct yang_list_keys *keys);
/* Get YANG keys from an existing dnode */
extern int yang_get_node_keys(struct lyd_node *node, struct yang_list_keys *keys);