diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-08-12 01:13:32 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-12 11:41:18 +0200 |
commit | 7aa5a2bc0f35c1874859a172f2a0d3708e969984 (patch) | |
tree | d7b1da9a54b9f4ac3b7150bc6c1686cfb65a3eb1 /Shell | |
parent | 1dc557424541f156357ced93a2f87f0fab9e05aa (diff) | |
download | serenity-7aa5a2bc0f35c1874859a172f2a0d3708e969984.zip |
Shell: Eliminate possible use-after-free in builtin_fg()
This fixes a possible UAF where the job might be destroyed in
block_on_job().
Diffstat (limited to 'Shell')
-rw-r--r-- | Shell/Builtin.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index 9ca91a71ee..e23588dbf0 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -332,7 +332,7 @@ int Shell::builtin_fg(int argc, const char** argv) if (job_id == -1 && !jobs.is_empty()) job_id = find_last_job_id(); - auto* job = const_cast<Job*>(find_job(job_id)); + RefPtr<Job> job = find_job(job_id); if (!job) { if (job_id == -1) { |