Loading
fix: correct StrCat rule case sensitivity
What does this MR do?
Fixes the case sensitivity of c_buffer_rule-StrCat-StrCatA so that it correctly matches the Windows API functions StrCat() and StrCatA() instead of lowercase strcat() and strcatA().
This prevents duplicate findings because lowercase strcat() is already detected by c_buffer_rule-strcat.
Changes:
- Updated the Semgrep patterns to match
StrCat(...)andStrCatA(...). - Updated positive test cases to use the correct Windows API function names.
- Added a negative test case confirming that lowercase
strcat()does not triggerc_buffer_rule-StrCat-StrCatA. - Added an Unreleased changelog entry.
- Kept the existing
StrcatW,lstrcatA, andlstrcatWpatterns unchanged. - Kept the existing flawfinder mappings unchanged.
What are the relevant issue numbers?
Closes gitlab-org/gitlab#639844
Does this MR meet the acceptance criteria?
- Test cases cover both positive and negative cases with appropriate Semgrep annotations:
- Positive cases:
// ruleid: c_buffer_rule-StrCat-StrCatAforStrCat()andStrCatA(). - Negative case:
// ok: c_buffer_rule-StrCat-StrCatAfor lowercasestrcat().
- Positive cases:
- Updated patterns use the correct case-sensitive Windows API function names.
- Existing rule metadata is preserved.
- Existing
StrcatW,lstrcatA, andlstrcatWpatterns remain unchanged. - Flawfinder mappings remain unchanged.
- Added a changelog entry describing the fix.
- Targeted Semgrep tests pass: 25/25.
- Full repository test suite passes: 547/547.
git diff --checkpasses.- MR is freshly rebased with
main.