Fix: possible load config domain overwrite
authorDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 17:48:53 +0000 (13:48 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 17:48:53 +0000 (13:48 -0400)
The uniqueness of the domain CAN NOT be enforced with the XML xsd schema
so if the same domains are seen, return an error.

Fixes coverity issue 1191755.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/config/config.c

index 5e100a7ab6c9c6e66848f5010acc711ffba51b8d..4eaa274e82ce9e24d7f06d29c0c73ba8a80793d4 100644 (file)
@@ -2198,12 +2198,24 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
 
                switch (domain->type) {
                case LTTNG_DOMAIN_KERNEL:
+                       if (kernel_domain) {
+                               /* Same domain seen twice, invalid! */
+                               goto domain_init_error;
+                       }
                        kernel_domain = domain;
                        break;
                case LTTNG_DOMAIN_UST:
+                       if (ust_domain) {
+                               /* Same domain seen twice, invalid! */
+                               goto domain_init_error;
+                       }
                        ust_domain = domain;
                        break;
                case LTTNG_DOMAIN_JUL:
+                       if (jul_domain) {
+                               /* Same domain seen twice, invalid! */
+                               goto domain_init_error;
+                       }
                        jul_domain = domain;
                        break;
                default:
This page took 0.027643 seconds and 4 git commands to generate.