X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=1eac93487a12604edb9095edb42e3ee53f08cf65;hp=b436777d671b74bb2165d97eae9a5e6a1c6604e7;hb=fae9a062a468c47fc71ef7aa96374bf9d87d137e;hpb=2fa605f7de6b95f50fc864072bc1445c61eb2c79 diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index b436777d6..1eac93487 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -25,6 +25,7 @@ #include #include +#include #include "../command.h" @@ -106,7 +107,8 @@ static char *get_cmdline_by_pid(pid_t pid) int ret; FILE *fp = NULL; char *cmdline = NULL; - char path[20]; /* Can't go bigger than /proc/65535/cmdline */ + /* Can't go bigger than /proc/LTTNG_MAX_PID/cmdline */ + char path[sizeof("/proc//cmdline") + sizeof(LTTNG_MAX_PID_STR) - 1]; snprintf(path, sizeof(path), "/proc/%d/cmdline", pid); fp = fopen(path, "r");