X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng%2Fcommands%2Fenable_events.c;h=5b844e493d13c7d4f44b358a02205dd325df9ef6;hb=6e0de39b61d0306e5794342d61ed356f44248f53;hp=b99b7f4c942294784f577ea8465009aa2b0134c0;hpb=8f0d098bc0b14f00c4d6ea3f48809626fa1c416f;p=lttng-tools.git diff --git a/lttng/commands/enable_events.c b/lttng/commands/enable_events.c index b99b7f4c9..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; @@ -275,7 +279,7 @@ static int enable_events(void) ret = CMD_NOT_IMPLEMENTED; goto error; } else { - ERR("Please specify a tracer (kernel or user-space)"); + ERR("Please specify a tracer (--kernel or --userspace)"); goto error; }