In the case of a command line match, load_proc_cmdline would return a
pointer that was not obtained from malloc, which then would be freed in
kill_all. This behavior could result in a SIGSEGV.
In the case of an empty command line, load_proc_cmdline would return -1,
causing its internal buffer to be leaked in kill_all.
Signed-off-by: Radu Rendec <radu.rendec@mindbit.ro>
Signed-off-by: Craig Small <csmall@enc.com.au>
p = p ? p+1 : command_buf;
if (strncmp(p, comm, COMM_LEN-1) == 0) {
okay = 1;
- *command = p;
+ if (!(*command = strdup(p)))
+ exit(1);
break;
}
}