X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsyscall.c;h=eb81d67429a2d96ac6b062db40940988ad0dd58c;hp=95d30d07459dc98d12dfb2ca680f1773cdac7c52;hb=6c1c0768320135c6936c371b09731851b508c023;hpb=834978fd9e2392f20867351ca99bf7bdf31b4f56 diff --git a/src/bin/lttng-sessiond/syscall.c b/src/bin/lttng-sessiond/syscall.c index 95d30d074..eb81d6742 100644 --- a/src/bin/lttng-sessiond/syscall.c +++ b/src/bin/lttng-sessiond/syscall.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -35,7 +36,7 @@ static size_t syscall_table_nb_entry; * Populate the system call table using the kernel tracer. * * Return 0 on success and the syscall table is allocated. On error, a negative - * value is returned and the syscall table is set to NULL. + * value is returned. */ int syscall_init_table(void) { @@ -81,7 +82,15 @@ int syscall_init_table(void) size_t new_nbmem; /* Double memory size. */ - new_nbmem = index << 1; + new_nbmem = max(index, nbmem << 1); + if (new_nbmem < nbmem) { + /* Overflow, stop everything, something went really wrong. */ + ERR("Syscall listing memory size overflow. Stopping"); + free(syscall_table); + syscall_table = NULL; + ret = -EINVAL; + goto error; + } DBG("Reallocating syscall table from %zu to %zu entries", nbmem, new_nbmem);