Skip to main content

SKY-D435 · Security in code

Unbounded C library write

MediumCWE-676

Skylos reports direct C library calls in C++ that write into a buffer without a capacity argument. The scanner resolves recognized calls to the C standard library.

Languages
C++
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

An oversized source string can exceed the destination buffer and corrupt nearby memory. The call gives the library no way to enforce the destination capacity.

What Skylos flags

format.cpp · C++Reported on line 5
#include <cstdio> void copy_label(const char *label) {    char buffer[32];    std::sprintf(buffer, "%s", label);}

What Skylos leaves alone

format.cpp · C++
#include <cstdio> void copy_label(const char *label) {    char buffer[32];    std::snprintf(buffer, sizeof(buffer), "%s", label);}

Why Skylos leaves it alone

The bounded call supplies the actual capacity of the destination array.

How Skylos decides

  1. Recognizes direct C library calls such as sprintf, strcpy and strcat with visible standard-library identity.
  2. The rule checks for a missing bound in the API. It does not prove the input length or verify a size expression passed to a different API.

How to fix it

Use a managed string or an API that receives the destination capacity. Handle errors and truncation when using a fixed-size buffer.

When it can be wrong

  • A caller might already enforce a length bound. Preserve it and prefer an API that checks the destination capacity directly.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Mark the reviewed line with a rule-scoped Skylos ignore for SKY-D435. Record the evidence that justifies the exception.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.