SKY-D435 · Security in code
Unbounded C library write
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
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
#include <cstdio> void copy_label(const char *label) { char buffer[32]; std::sprintf(buffer, "%s", label);}What Skylos leaves alone
#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
- Recognizes direct C library calls such as sprintf, strcpy and strcat with visible standard-library identity.
- 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.