Fix: unchecked buffer size for communication header
[lttng-tools.git] / src / common / actions / notify.c
CommitLineData
a58c490f 1/*
ab5be9fa 2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
a58c490f 3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
a58c490f 5 *
a58c490f
JG
6 */
7
8#include <lttng/action/action-internal.h>
9#include <lttng/action/notify-internal.h>
10#include <common/macros.h>
11#include <assert.h>
12
13static
14void lttng_action_notify_destroy(struct lttng_action *action)
15{
16 free(action);
17}
18
19static
3647288f 20int lttng_action_notify_serialize(struct lttng_action *action,
c0a66c84 21 struct lttng_payload *payload)
a58c490f
JG
22{
23 return 0;
24}
25
3dd04a6a
JR
26static
27bool lttng_action_notify_is_equal(const struct lttng_action *a,
28 const struct lttng_action *b)
29{
30 /* There is no discriminant between notify actions. */
31 return true;
32}
33
a58c490f
JG
34struct lttng_action *lttng_action_notify_create(void)
35{
36 struct lttng_action_notify *notify;
37
38 notify = zmalloc(sizeof(struct lttng_action_notify));
39 if (!notify) {
40 goto end;
41 }
42
6acb3f46
SM
43 lttng_action_init(&notify->parent, LTTNG_ACTION_TYPE_NOTIFY, NULL,
44 lttng_action_notify_serialize,
3dd04a6a 45 lttng_action_notify_is_equal,
6acb3f46 46 lttng_action_notify_destroy);
a58c490f
JG
47end:
48 return &notify->parent;
49}
869a3c2d 50
c0a66c84
JG
51ssize_t lttng_action_notify_create_from_payload(
52 struct lttng_payload_view *view,
869a3c2d
SM
53 struct lttng_action **action)
54{
55 ssize_t consumed_length;
56
57 *action = lttng_action_notify_create();
58 if (!*action) {
59 consumed_length = -1;
60 goto end;
61 }
62
63 consumed_length = 0;
64end:
65 return consumed_length;
66}
This page took 0.036067 seconds and 4 git commands to generate.