From bf9807db5cc26f3feee63c66a000d110d3886cb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 23 Aug 2015 00:22:45 -0400 Subject: [PATCH 1/1] Ensure event names are NULL terminated during validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/cmd.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.34.1