Fix: Possible passing of NULL pointer to memcpy()
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 41f6582384cf5c5577ece366f9e6b8c2c217be76..6237d673efca6b1abd5c778949c8863be6fc72ef 100644 (file)
@@ -1114,9 +1114,40 @@ int cmd_enable_channel(struct ltt_session *session,
                break;
        }
        case LTTNG_DOMAIN_UST:
+       case LTTNG_DOMAIN_JUL:
+       case LTTNG_DOMAIN_LOG4J:
+       case LTTNG_DOMAIN_PYTHON:
        {
                struct ltt_ust_channel *uchan;
 
+               /*
+                * FIXME
+                *
+                * Current agent implementation limitations force us to allow
+                * only one channel at once in "agent" subdomains. Each
+                * subdomain has a default channel name which must be strictly
+                * adhered to.
+                */
+               if (domain->type == LTTNG_DOMAIN_JUL) {
+                       if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME,
+                                       LTTNG_SYMBOL_NAME_LEN)) {
+                               ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
+                               goto error;
+                       }
+               } else if (domain->type == LTTNG_DOMAIN_LOG4J) {
+                       if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME,
+                                       LTTNG_SYMBOL_NAME_LEN)) {
+                               ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
+                               goto error;
+                       }
+               } else if (domain->type == LTTNG_DOMAIN_PYTHON) {
+                       if (strncmp(attr->name, DEFAULT_PYTHON_CHANNEL_NAME,
+                                       LTTNG_SYMBOL_NAME_LEN)) {
+                               ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
+                               goto error;
+                       }
+               }
+
                chan_ht = usess->domain_global.channels;
 
                uchan = trace_ust_find_channel_by_name(chan_ht, attr->name);
@@ -1795,6 +1826,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                                filter_copy = zmalloc(filter_size);
                                if (!filter_copy) {
                                        ret = LTTNG_ERR_NOMEM;
+                                       goto error;
                                }
                                memcpy(filter_copy, filter, filter_size);
 
This page took 0.024382 seconds and 4 git commands to generate.