X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Factions%2Fgroup.c;h=afb832ee646a766b40142f87eae385eb178b7fa4;hb=2d57482cbac710612a36b7beae7b59c277006185;hp=31c6f456ebcdf2c11c3e0da702f5733befd13eac;hpb=17182cfd13b6d35cf8c80d4f9ccf8d2bdd1a05f2;p=lttng-tools.git diff --git a/src/common/actions/group.c b/src/common/actions/group.c index 31c6f456e..afb832ee6 100644 --- a/src/common/actions/group.c +++ b/src/common/actions/group.c @@ -217,6 +217,11 @@ ssize_t lttng_action_group_create_from_payload( lttng_payload_view_from_view(view, consumed_len, view->buffer.size - consumed_len); + if (!lttng_payload_view_is_valid(&child_view)) { + consumed_len = -1; + goto end; + } + consumed_len_child = lttng_action_create_from_payload( &child_view, &child_action); if (consumed_len_child < 0) { @@ -261,8 +266,8 @@ struct lttng_action *lttng_action_group_create(void) lttng_action_init(action, LTTNG_ACTION_TYPE_GROUP, lttng_action_group_validate, lttng_action_group_serialize, - lttng_action_group_is_equal, - lttng_action_group_destroy); + lttng_action_group_is_equal, lttng_action_group_destroy, + NULL); lttng_dynamic_pointer_array_init(&action_group->actions, destroy_lttng_action_group_element); @@ -328,10 +333,17 @@ end: const struct lttng_action *lttng_action_group_get_at_index( const struct lttng_action *group, unsigned int index) +{ + return lttng_action_group_borrow_mutable_at_index(group, index); +} + +LTTNG_HIDDEN +struct lttng_action *lttng_action_group_borrow_mutable_at_index( + const struct lttng_action *group, unsigned int index) { unsigned int count; const struct lttng_action_group *action_group; - const struct lttng_action * action = NULL; + struct lttng_action *action = NULL; if (lttng_action_group_get_count(group, &count) != LTTNG_ACTION_STATUS_OK) {