CRITICAL
Rule Definition
Buffer overflows can cause the program to crash at a minimum. At worst, a carefully crafted overflow can cause malicious code to be executed.
Remediation
In such cases, it's better to use an alternate, secure function which allows you to define the maximum number of characters to be written to the buffer:
strlcpy (BSD library) or strncpy
strlcat (BSD library) or strncat
snprintf
fgets
getpwuid
Violation Code Sample
CALL 'gets' USING in-line RETURNING in-line.
Reference
OWASP Top 10 2017 Category A9 - Using Components with Known Vulnerabilities
MITRE, CWE-120 - Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
MITRE, CWE-676 - Use of Potentially Dangerous Function
Related Technologies
Technical Criterion
CWE-120 - Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.