Repository navigation
fix(OSQUERY-004): CU-86akhf8u2 2 review findings across 2 files #102
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 |
|---|---|---|
|
|
@@ -29,6 +29,12 @@ struct utf_converter { | |
| result.resize(str.length() * 2); | ||
| auto count = MultiByteToWideChar( | ||
| CP_UTF8, 0, str.c_str(), -1, &result[0], str.length() * 2); | ||
| if (count <= 0) { | ||
| LOG(WARNING) << "Failed to convert string to wstring, " | ||
| "MultiByteToWideChar error " | ||
| << GetLastError(); | ||
| return std::wstring(); | ||
| } | ||
| result.resize(count - 1); | ||
| } | ||
|
|
||
|
Comment on lines
29
to
40
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. 𦩠π Silent truncation when MultiByteToWideChar/WideCharToMultiByte fail (count==0) is not logged In π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
|
|
@@ -47,6 +53,12 @@ struct utf_converter { | |
| str.length() * 4, | ||
| NULL, | ||
| NULL); | ||
| if (count <= 0) { | ||
| LOG(WARNING) << "Failed to convert wstring to string, " | ||
| "WideCharToMultiByte error " | ||
| << GetLastError(); | ||
| return std::string(); | ||
| } | ||
| result.resize(count - 1); | ||
| } | ||
|
|
||
|
|
@@ -169,3 +181,4 @@ std::string errorDwordToString(DWORD error_code) { | |
| } | ||
|
|
||
| } // 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.
𦩠π YARA compilation error/warning messages logged only at VLOG(1), losing visibility on real compile errors
In
YARACompilerCallback(osquery/tables/yara/yara_utils.cpp), changed theerror_level == YARA_ERROR_LEVEL_ERRORbranch fromVLOG(1)toLOG(ERROR)so compile errors are always visible in normal operation; the warning branch remainsVLOG(1)as suggested, leaving that behavior unchanged.π€ Prompt for AI agents
fix confidence: π’ 92 high β react π/π to teach the reviewer