X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fenable_events.c;h=18793ae095a77cbe8365f09ac0576a06011ea407;hb=e051e07cc7a14b604cc2d7d851075f9d4289725d;hp=2af85fe476eb74abaf71ea7b456a6ee1723408b1;hpb=b688191f72e58d2b5c317ca52b4c2b1743f2586c;p=lttng-tools.git diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 2af85fe47..18793ae09 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -268,7 +268,11 @@ int loglevel_str_to_value(const char *inputstr) 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++; }