C format-string rule: macros that expand to string literals are constant formats #380

Closed
opened 2026-09-25 07:59:09 +00:00 by sharang · 0 comments
Owner

Problem

The C format-string rule fires on sprintf(buf, GET_REQUEST) when GET_REQUEST is a macro that expands to a string literal (seen in anon767/STM32F7HTTPS). That is a false positive: the format string is a constant.

Done when

Upper-case macro identifiers are treated as constant format strings (semgrep metavariable-regex), with a test for both the literal and the macro case.

## Problem The C format-string rule fires on `sprintf(buf, GET_REQUEST)` when `GET_REQUEST` is a macro that expands to a string literal (seen in `anon767/STM32F7HTTPS`). That is a false positive: the format string is a constant. ## Done when Upper-case macro identifiers are treated as constant format strings (semgrep `metavariable-regex`), with a test for both the literal and the macro case.
sharang added this to the Production MVP milestone 2026-09-25 07:59:09 +00:00
sharang added the bug label 2026-09-25 07:59:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#380