int i = 0;
char str[LTTNG_SYMBOL_NAME_LEN];
- while (i < LTTNG_SYMBOL_NAME_LEN && inputstr[i] != '\0') {
+ /*
+ * Loop up to LTTNG_SYMBOL_NAME_LEN minus one because the NULL bytes is
+ * added at the end of the loop so a the upper bound we avoid the overflow.
+ */
+ while (i < (LTTNG_SYMBOL_NAME_LEN - 1) && inputstr[i] != '\0') {
str[i] = toupper(inputstr[i]);
i++;
}
ret = lttng_enable_event_with_filter(handle, &ev, channel_name,
opt_filter);
if (ret < 0) {
- fprintf(stderr, "Ret filter: %d\n", ret);
switch (-ret) {
case LTTNG_ERR_FILTER_EXIST:
WARN("Filter on events is already enabled"
break;
case LTTNG_ERR_FILTER_INVAL:
case LTTNG_ERR_FILTER_NOMEM:
- ERR("%s", lttng_strerror(ret));
default:
- ERR("Setting filter: '%s'", opt_filter);
+ ERR("%s", lttng_strerror(ret));
break;
}
goto error;