Fix: Possible call to strtoul() with NULL argument
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index c542179371327b951d71255902b949c789f265fd..89ef3b092737d23ae83c17af76d826df953fb0b3 100644 (file)
@@ -2766,6 +2766,9 @@ static int create_ust_session(struct ltt_session *session,
        lus->live_timer_interval = session->live_timer;
        session->ust_session = lus;
        if (session->shm_path[0]) {
+               strncpy(lus->root_shm_path, session->shm_path,
+                       sizeof(lus->root_shm_path));
+               lus->root_shm_path[sizeof(lus->root_shm_path) - 1] = '\0';
                strncpy(lus->shm_path, session->shm_path,
                        sizeof(lus->shm_path));
                lus->shm_path[sizeof(lus->shm_path) - 1] = '\0';
@@ -4609,6 +4612,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                } else {
                        unsigned long v;
 
+                       if (!arg) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
                        errno = 0;
                        v = strtoul(arg, NULL, 0);
                        if (errno != 0 || !isdigit(arg[0])) {
This page took 0.024078 seconds and 4 git commands to generate.