Skip to content

Commit d5545e9

Browse files
committed
schema parsers BUGFIX duplicating iffeature expression data
When instantiating a grouping into a uses statement, if-feature expression of the instatiated data nodes are duplicated. There was a bug when counting the size of the original expression data so in case of a long expression only a part of the expression was duplicated which led to a segfault when the duplicated expression was parsed. Fixes #887
1 parent 2155311 commit d5545e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tree_schema.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3167,7 +3167,7 @@ lys_node_dup_recursion(struct lys_module *module, struct lys_node *parent, const
31673167
/* there is something to duplicate */
31683168

31693169
/* duplicate compiled expression */
3170-
size = (size1 / 4) + (size1 % 4) ? 1 : 0;
3170+
size = (size1 / 4) + ((size1 % 4) ? 1 : 0);
31713171
retval->iffeature[i].expr = malloc(size * sizeof *retval->iffeature[i].expr);
31723172
LY_CHECK_ERR_GOTO(!retval->iffeature[i].expr, LOGMEM(ctx), error);
31733173
memcpy(retval->iffeature[i].expr, node->iffeature[i].expr, size * sizeof *retval->iffeature[i].expr);

0 commit comments

Comments
 (0)