Skip to content
vetkitChecksChangelogDocumentation

vetkit.c.memory.scanf-unbounded-string

A scanf-family call reads a string with %s or %[ and no field width, so long input overflows the buffer.

Last updated:

Suite: Security

c, cpp

A scanf-family call reads a string with %s or %[ and no field width, so long input overflows the buffer.

Category: SECURITY · Engine rule severity: ERROR

How to fix it

Give every %s / %[ conversion a maximum width one less than the buffer size (e.g. "%63s" for char buf[64]), or read the line with fgets and parse it.

References

Source: packages/engine/rules/sast/c.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.