Skip to content

Commit b89b5ae

Browse files
committed
plugins types UPDATE always validate union values
If skipped, the value may be stored as an incorrect type, which is not expected. Fixes sysrepo/sysrepo#3475
1 parent ffd1823 commit b89b5ae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/plugins_types/union.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, c
401401
ret = lyb_fill_subvalue(ctx, type_u, value, value_len, prefix_data, subvalue, &options, unres, err);
402402
LY_CHECK_GOTO((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE), cleanup);
403403
} else {
404+
/* to correctly resolve the union type, we need to always validate the value */
405+
options &= ~LYPLG_TYPE_STORE_ONLY;
406+
404407
/* store value to subvalue */
405408
ret = union_subvalue_assignment(value, value_len, &subvalue->original, &subvalue->orig_len, &options);
406409
LY_CHECK_GOTO(ret, cleanup);

0 commit comments

Comments
 (0)