Skip to content
OpenAdvisories

Weakness (CWE)

CWE-193: Off-by-one Error

Base Draft

A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.

How to prevent it (1 mitigation)
  1. Implementation

    When 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().

Source: MITRE CWE-193

1 result · Clear filters · Feed

  • High 7.8
    CVE-2021-3156 Exploited Public exploit EPSS 100%

    Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privileg…

    KEV Apr 6, 2022