CWE•Base•Draft•20 recent CVEs
CWE-193Off-by-one Error
Description
A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.
Common consequences
- Availability→DoS: Crash, Exit, or Restart,DoS: Resource Consumption (CPU),DoS: Resource Consumption (Memory),DoS: InstabilityThis weakness will generally lead to undefined behavior and therefore crashes. In the case of overflows involving loop index variables, the likelihood of infinite loops is also high.
- Integrity→Modify MemoryIf the value in question is important to data (as opposed to flow), simple data corruption has occurred. Also, if the wrap around results in other conditions such as buffer overflows, further memory corruption may occur.
- Confidentiality,Availability,Access Control→Execute Unauthorized Code or Commands,Bypass Protection MechanismThis weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program's implicit security policy.
Potential mitigations
- ImplementationWhen copying character arrays or using character manipulation methods, the correct size parameter must be used to account for the null terminator that needs to be added at the end of the array. Some examples of functions susceptible to this weakness in C include strcpy(), strncpy(), strcat(), strncat(), printf(), sprintf(), scanf() and sscanf().
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-83572026-06-15CVE-2026-544108.62026-06-14CVE-2026-465594.02026-06-10CVE-2026-453803.62026-06-10CVE-2026-453585.32026-06-10CVE-2026-491278.62026-05-28CVE-2026-420155.32026-05-26CVE-2026-486899.82026-05-26CVE-2026-440654.22026-05-21CVE-2026-452323.12026-05-20CVE-2026-446033.72026-05-07CVE-2026-75724.42026-05-06CVE-2026-439643.72026-05-04CVE-2026-438603.72026-05-04CVE-2026-415027.52026-04-24CVE-2026-402544.22026-04-24CVE-2026-68616.12026-04-22CVE-2026-403126.22026-04-13CVE-2026-326057.52026-04-13CVE-2026-339976.82026-03-31