[high] semgrep: sprintf() writes without a bound on the destination — input longer than the buffer overflows it (CWE-120). #841

Closed
opened 2026-11-04 16:32:31 +00:00 by pruefwerk · 1 comment
Member

high Finding

Scanner: semgrep
Severity: high
Rule: cra-ai-20-c-unbounded-string-function
CWE: CWE-120
CRA: cra-ai-20 — Automatisierte Sicherheitstests (Annex I)

Description

sprintf() writes without a bound on the destination — input longer than the buffer overflows it (CWE-120). Use a bounded call (snprintf, strncpy/strlcpy with the buffer size).

Location

File: fixtures/nightly/firmware/c-sensor-node/Core/Src/comms.c (line 25)

Code

    sprintf(reply, "ack:%s", command);

Remediation

Exclude fixtures/nightly from security scanning or mark it as test code.


Fingerprint: 6dc616f97faf72f911f0762bfc1603666d70bb55879809c43fcd87f9fcfddde6
Generated by compliance-scanner
Open in Prüfwerk / In Prüfwerk öffnen

## high Finding **Scanner:** semgrep **Severity:** high **Rule:** cra-ai-20-c-unbounded-string-function **CWE:** CWE-120 **CRA:** cra-ai-20 — Automatisierte Sicherheitstests (Annex I) ### Description sprintf() writes without a bound on the destination — input longer than the buffer overflows it (CWE-120). Use a bounded call (snprintf, strncpy/strlcpy with the buffer size). ### Location **File:** `fixtures/nightly/firmware/c-sensor-node/Core/Src/comms.c` (line 25) ### Code ``` sprintf(reply, "ack:%s", command); ``` ### Remediation Exclude fixtures/nightly from security scanning or mark it as test code. --- *Fingerprint:* `6dc616f97faf72f911f0762bfc1603666d70bb55879809c43fcd87f9fcfddde6` *Generated by compliance-scanner* [Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
pruefwerk added the cra:annex-ipruefwerkseverity:high labels 2026-11-04 16:32:31 +00:00
Author
Member

Prüfwerk: Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind.

The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.

**Prüfwerk:** Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind. The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#841