From: Jérémie Galarneau Date: Sun, 23 Aug 2015 04:22:45 +0000 (-0400) Subject: Ensure event names are NULL terminated during validation X-Git-Tag: v2.8.0-rc1~478 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=bf9807db5cc26f3feee63c66a000d110d3886cb8 Ensure event names are NULL terminated during validation Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index a80668831..8f450acde 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1383,6 +1383,7 @@ static int validate_event_name(const char *name) int ret = 0; const char *c = name; const char *event_name_end = c + LTTNG_SYMBOL_NAME_LEN; + bool null_terminated = false; /* * Make sure that unescaped wildcards are only used as the last @@ -1391,6 +1392,7 @@ static int validate_event_name(const char *name) while (c < event_name_end) { switch (*c) { case '\0': + null_terminated = true; goto end; case '\\': c++; @@ -1407,6 +1409,9 @@ static int validate_event_name(const char *name) c++; } end: + if (!ret && !null_terminated) { + ret = LTTNG_ERR_INVALID_EVENT_NAME; + } return ret; }