Fix: session name max length was not handled correctly
[lttng-tools.git] / src / bin / lttng / commands / set_session.c
index a428aed16ce239257253ae2f1fd7178fc4ff69e8..1f79d6cf08e6f17c97f972a58269cb0b102362f9 100644 (file)
@@ -60,6 +60,13 @@ static int set_session(void)
 {
        int ret = CMD_SUCCESS;
 
+       if (opt_session_name && strlen(opt_session_name) > NAME_MAX) {
+               ERR("Session name too long. Length must be lower or equal to %d",
+                       NAME_MAX);
+               ret = CMD_ERROR;
+               goto error;
+       }
+
        ret = config_init(opt_session_name);
        if (ret < 0) {
                ERR("Unable to set session name");
This page took 0.023764 seconds and 4 git commands to generate.