X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Fcommands%2Fenable_events.c;h=5b844e493d13c7d4f44b358a02205dd325df9ef6;hp=0f376ad09230c759ea6d0d525c9432e3fe698f07;hb=99497cd03fb27fd2416a88d80292a0cc5647bff2;hpb=773168b7255d45fd28f018055292e93b7a76482d diff --git a/lttng/commands/enable_events.c b/lttng/commands/enable_events.c index 0f376ad09..5b844e493 100644 --- a/lttng/commands/enable_events.c +++ b/lttng/commands/enable_events.c @@ -125,6 +125,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt) ret = sscanf(opt, "%[^'+']+%s", name, s_hex); if (ret == 2) { strncpy(ev->attr.probe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN); + ev->attr.probe.symbol_name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; DBG("probe symbol %s", ev->attr.probe.symbol_name); if (strlen(s_hex) == 0) { ERR("Invalid probe offset %s", s_hex); @@ -142,6 +143,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt) ret = sscanf(opt, "%s", name); if (ret == 1) { strncpy(ev->attr.probe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN); + ev->attr.probe.symbol_name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; DBG("probe symbol %s", ev->attr.probe.symbol_name); ev->attr.probe.offset = 0; DBG("probe offset %" PRIu64, ev->attr.probe.offset); @@ -230,6 +232,7 @@ static int enable_events(void) event_name, channel_name); /* Copy name and type of the event */ strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN); + ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; ev.type = opt_event_type; switch (opt_event_type) { @@ -255,6 +258,7 @@ static int enable_events(void) strncpy(ev.attr.ftrace.symbol_name, opt_function_entry_symbol, LTTNG_SYMBOL_NAME_LEN); + ev.attr.ftrace.symbol_name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; break; default: ret = CMD_NOT_IMPLEMENTED;