Add the sessiond notification-handling subsystem
[lttng-tools.git] / src / bin / lttng-sessiond / syscall.c
index 7ae6682bb419c06c6cdd8231c5c92d0dbef475c4..6ee38bd0fa27a3f51c5541f8601a890d130b8aed 100644 (file)
@@ -51,7 +51,7 @@ int syscall_init_table(void)
 
        fd = kernctl_syscall_list(kernel_tracer_fd);
        if (fd < 0) {
-               ret = -errno;
+               ret = fd;
                PERROR("kernelctl syscall list");
                goto error_ioctl;
        }
@@ -82,7 +82,7 @@ int syscall_init_table(void)
 
                        /* Double memory size. */
                        new_nbmem = max(index, nbmem << 1);
-                       if (new_nbmem < nbmem) {
+                       if (new_nbmem > (SIZE_MAX / sizeof(*new_list))) {
                                /* Overflow, stop everything, something went really wrong. */
                                ERR("Syscall listing memory size overflow. Stopping");
                                free(syscall_table);
@@ -108,8 +108,13 @@ int syscall_init_table(void)
                }
                syscall_table[index].index = index;
                syscall_table[index].bitness = bitness;
-               strncpy(syscall_table[index].name, name,
-                               sizeof(syscall_table[index].name));
+               if (lttng_strncpy(syscall_table[index].name, name,
+                               sizeof(syscall_table[index].name))) {
+                       ret = -EINVAL;
+                       free(syscall_table);
+                       syscall_table = NULL;
+                       goto error;
+               }
                /*
                DBG("Syscall name '%s' at index %" PRIu32 " of bitness %u",
                                syscall_table[index].name,
This page took 0.025308 seconds and 5 git commands to generate.