Skip to content

Commit

Permalink
codeql fixes (#107422)
Browse files Browse the repository at this point in the history
* codeql fix

* explicitly null terminating the status
  • Loading branch information
mangod9 authored Sep 6, 2024
1 parent b10f5c9 commit 1bad124
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 1bad124

Please sign in to comment.