X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=4904d2772b5181bb835d928595671b456b38f562;hp=45357598362ac9c0fb1c2f031609c0c79fd4ea2b;hb=245463865cdd6ecb616d3ad8ddb8db11b7538d71;hpb=3842aa86ec7a7a32abc4e436013a2419b24ecc63 diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 453575983..4904d2772 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -383,7 +383,9 @@ static int add_context(char *session_name) if (context.ctx == LTTNG_EVENT_CONTEXT_PERF_COUNTER) { context.u.perf_counter.type = type->opt->u.perf.type; context.u.perf_counter.config = type->opt->u.perf.config; - strcpy(context.u.perf_counter.name, type->opt->symbol); + strncpy(context.u.perf_counter.name, type->opt->symbol, + LTTNG_SYMBOL_NAME_LEN); + context.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; /* Replace : and - by _ */ while ((ptr = strchr(context.u.perf_counter.name, '-')) != NULL) { *ptr = '_';