Ensure event names are NULL terminated during validation
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 23 Aug 2015 04:22:45 +0000 (00:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 23 Aug 2015 04:24:13 +0000 (00:24 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index a80668831076a4396d14bdd45d2c155a01e7641c..8f450acdef70287cd6b757d06d254a13ad2afd39 100644 (file)
@@ -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;
 }
 
This page took 0.027494 seconds and 4 git commands to generate.