Skip to content

codeql fixes #107422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/coreclr/hosts/corerun/corerun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ namespace pal
#else // !__APPLE__
// Use procfs to detect if there is a tracer process.
// See https://www.kernel.org/doc/html/latest/filesystems/proc.html
char status[2048] = { 0 };
char status[2048];
int fd = ::open("/proc/self/status", O_RDONLY);
if (fd == -1)
{
Expand All @@ -471,6 +471,8 @@ namespace pal
{
// We have data. At this point we can likely make a strong decision.
const char tracer_pid_name[] = "TracerPid:";
// null terminate status
status[bytes_read] = '\0';
const char* tracer_pid_ptr = ::strstr(status, tracer_pid_name);
if (tracer_pid_ptr == nullptr)
return debugger_state_t::not_attached;
Expand Down