Skip to content

Commit

Permalink
Fix a warning from UBSAN
Browse files Browse the repository at this point in the history
I won't pretend I understand what UBSAN is really trying to tell me
here, but that assignment can be rewritten in a way which does not cause
the following warning:

 libyang/src/tree_data.c:5564:19: runtime error: member access within address 0x60600005c7e0 with insufficient space for an object of type 'struct lyd_node'
 0x60600005c7e0: note: pointer points here
  1c 00 00 26  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
               ^

Fixes: sysrepo/sysrepo#2295
  • Loading branch information
jktjkt committed Jan 26, 2021
1 parent 22eb8cb commit 2f717b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tree_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -5561,7 +5561,7 @@ _lyd_dup_node(const struct lyd_node *node, const struct lys_node *schema, struct
new_any = calloc(1, sizeof *new_any);
new_node = (struct lyd_node *)new_any;
LY_CHECK_ERR_GOTO(!new_node, LOGMEM(ctx), error);
new_node->schema = (struct lys_node *)schema;
new_any->schema = (struct lys_node *)schema;

if (_lyd_dup_node_common(new_node, node, ctx, options)) {
goto error;
Expand Down

0 comments on commit 2f717b6

Please sign in to comment.