mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
fix: avoid cmd double-free in procevent_monitor
There is a possible execution path in procevent_monitor function, when allocated memory for cmd may be deallocated twice. Commit adds check before deallocating memory. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
This commit is contained in:
parent
ab605f26e2
commit
5ec00f70c8
1 changed files with 3 additions and 1 deletions
|
|
@ -496,7 +496,9 @@ static void __attribute__((noreturn)) procevent_monitor(const int sock, pid_t my
|
|||
sprintf(lineptr, "\n");
|
||||
else {
|
||||
sprintf(lineptr, " %s\n", cmd);
|
||||
free(cmd);
|
||||
if (cmd != pids[pid].option.event.cmd) {
|
||||
free(cmd);
|
||||
}
|
||||
}
|
||||
lineptr += strlen(lineptr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue