1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

Shell: Eliminate possible use-after-free in builtin_fg()

This fixes a possible UAF where the job might be destroyed in
block_on_job().
This commit is contained in:
AnotherTest 2020-08-12 01:13:32 +04:30 committed by Andreas Kling
parent 1dc5574245
commit 7aa5a2bc0f

View file

@ -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) {