Fix: illegal memory access in consumer_set_subdir
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index a8c5fb871d9521ba7853ae1019e0ce9e9571c4a7..934af39bd3f6028b69138765b39c22401e6dbfbe 100644 (file)
@@ -1089,7 +1089,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.025856 seconds and 5 git commands to generate.