Skip to content

BES1-941: Increase Process name buffer length from 16 to 64#306

Open
yogeswaransky wants to merge 1 commit intosupport/1.8.5from
topic/BES1-941
Open

BES1-941: Increase Process name buffer length from 16 to 64#306
yogeswaransky wants to merge 1 commit intosupport/1.8.5from
topic/BES1-941

Conversation

@yogeswaransky
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 1, 2026 12:15
@yogeswaransky yogeswaransky requested a review from a team as a code owner April 1, 2026 12:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the DCA utility header to allow longer process names by increasing the fixed buffer size used in procMemCpuInfo, which is used by process/memory/CPU collection helpers.

Changes:

  • Increased BUF_LEN macro from 16 to 64 in dcautil.h.

T2ERROR getGrepResults(GrepSeekProfile **GSP, Vector *markerList, bool isClearSeekMap, bool check_rotated, char *customLogPath);
#define PREFIX_SIZE 5
#define BUF_LEN 16
#define BUF_LEN 64
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing BUF_LEN increases the size of fixed arrays (e.g., procMemCpuInfo.processName), but current call sites copy into these arrays using length derived from the input string (e.g., memcpy(..., strlen(processName)+1) in dcaproc.c) without bounding to BUF_LEN. This remains a potential buffer overflow if a caller passes a name longer than BUF_LEN-1. Consider switching to a bounded copy (and optionally returning an error or explicitly truncating) everywhere these buffers are written.

Copilot uses AI. Check for mistakes.
T2ERROR getGrepResults(GrepSeekProfile **GSP, Vector *markerList, bool isClearSeekMap, bool check_rotated, char *customLogPath);
#define PREFIX_SIZE 5
#define BUF_LEN 16
#define BUF_LEN 64
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUF_LEN is used not only for processName but also for cpuUse and memUse in procMemCpuInfo, so this change increases those buffers as well. If the intent is strictly to increase the process name limit, consider introducing a dedicated PROCESS_NAME_LEN (leaving cpuUse/memUse unchanged) or update the PR title/description to reflect the broader impact.

Copilot uses AI. Check for mistakes.
T2ERROR getGrepResults(GrepSeekProfile **GSP, Vector *markerList, bool isClearSeekMap, bool check_rotated, char *customLogPath);
#define PREFIX_SIZE 5
#define BUF_LEN 16
#define BUF_LEN 64
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing unit tests covering getProcInfo/getProcUsage, but none appear to validate behavior with process names longer than the previous 16-byte limit. Since this change is explicitly increasing the supported name length, add a test that exercises a >16 and <=63 character processName to ensure it’s handled safely (no overflow/truncation surprises).

Copilot generated this review using guidance from repository custom instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants