Repository navigation
fix(OSQUERY-008): CU-86akhf8u2 3 review findings across 3 files #77
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| #include <osquery/filesystem/filesystem.h> | ||
| #include <osquery/logger/logger.h> | ||
|
|
||
| #define EXPECTED_GROUPS_MAX 64 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π EXPECTED_GROUPS_MAX macro violates kPascalCase constant naming convention Replaced π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer |
||
| constexpr int kExpectedGroupsMax = 64; | ||
|
|
||
| #ifdef __APPLE__ | ||
| // This symbol is exported from libSystem.B and has been since 10.6. | ||
|
|
@@ -65,14 +65,14 @@ static void getGroupsForUser(QueryData& results, | |
| } | ||
| delete[] groups; | ||
| #else | ||
| gid_type groups_buf[EXPECTED_GROUPS_MAX]; | ||
| gid_type groups_buf[kExpectedGroupsMax]; | ||
| gid_type* groups = groups_buf; | ||
| int ngroups = EXPECTED_GROUPS_MAX; | ||
| int ngroups = kExpectedGroupsMax; | ||
|
|
||
| // GLIBC version before 2.3.3 may have a buffer overrun: | ||
| // http://man7.org/linux/man-pages/man3/getgrouplist.3.html | ||
| if (getgrouplist(user.name, user.gid, groups, &ngroups) < 0) { | ||
| // EXPECTED_GROUPS_MAX was probably not large enough. | ||
| // kExpectedGroupsMax was probably not large enough. | ||
| // Try a larger size buffer. | ||
| groups = new gid_type[ngroups]; | ||
| if (groups == nullptr) { | ||
|
|
@@ -96,3 +96,4 @@ static void getGroupsForUser(QueryData& results, | |
| } | ||
| } // namespace tables | ||
| } // namespace osquery | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,23 +14,24 @@ namespace osquery { | |
| namespace { | ||
|
|
||
| /// Current tool type. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π File-scope constant kToolType does not follow the constant style but this is a mutable global, not a constant Renamed the mutable global variable π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| ToolType kToolType{ToolType::UNKNOWN}; | ||
| ToolType gToolType{ToolType::UNKNOWN}; | ||
|
|
||
| } // namespace | ||
|
|
||
| void setToolType(ToolType tool) { | ||
| kToolType = tool; | ||
| gToolType = tool; | ||
| } | ||
|
|
||
| ToolType getToolType() { | ||
| return kToolType; | ||
| return gToolType; | ||
| } | ||
|
|
||
| bool isDaemon() { | ||
| return kToolType == ToolType::DAEMON; | ||
| return gToolType == ToolType::DAEMON; | ||
| } | ||
|
|
||
| bool isShell() { | ||
| return kToolType == ToolType::SHELL; | ||
| return gToolType == ToolType::SHELL; | ||
| } | ||
| } // namespace osquery | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π kControlSettingsFiles / kControlSettingsDirs correctly named but CTL_MAX_VALUE macro breaks the k-prefix constant convention
Replaced
#define CTL_MAX_VALUE 128withconstexpr int kCtlMaxValue = 128;inside theosquery::tablesnamespace in sysctl_utils.h, per OSQUERY-008 naming convention. Risk: this constant may be referenced by nameCTL_MAX_VALUEin system_controls.cpp or platform-specific .cpp files (e.g. linux/darwin implementations) not visible here; if so, those call sites would fail to compile and need to be updated tokCtlMaxValueas well, which is outside this single-file fix's scope.π€ Prompt for AI agents
fix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer