Fix: illegal memory access in consumer_set_subdir
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index d9961a1725db793f58e47511c7453ddabc09517d..25cc4a213353424c56dce5e69e638831f5513020 100644 (file)
@@ -1088,7 +1088,11 @@ int consumer_set_subdir(struct consumer_output *consumer,
                goto error;
        }
 
-       strncpy(consumer->subdir, tmp_path, sizeof(consumer->subdir));
+       if (lttng_strncpy(consumer->subdir, tmp_path,
+                       sizeof(consumer->subdir))) {
+               ret = -EINVAL;
+               goto error;
+       }
        DBG2("Consumer subdir set to %s", consumer->subdir);
 
 error:
This page took 0.023395 seconds and 4 git commands to generate.