CWE Database
/

CWE-193

Back to CWE list

CWE-193

Off-by-one Error

Base
Draft

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

Scope

Availability

Impact

DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Instability

Scope

Integrity

Impact

Modify Memory

Scope

Confidentiality
Availability
Access Control

Impact

Execute Unauthorized Code or Commands, Bypass Protection Mechanism

Potential Mitigations

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

CVE-2003-0252

Off-by-one error allows remote attackers to cause a denial of service and possibly execute arbitrary code via requests that do not contain newlines.

CVE-2001-1391

Off-by-one vulnerability in driver allows users to modify kernel memory.

CVE-2002-0083

Off-by-one error allows local users or remote malicious servers to gain privileges.

CVE-2002-0653

Off-by-one buffer overflow in function usd by server allows local users to execute arbitrary code as the server user via .htaccess files with long entries.

CVE-2002-0844

Off-by-one buffer overflow in version control system allows local users to execute arbitrary code.

CVE-1999-1568

Off-by-one error in FTP server allows a remote attacker to cause a denial of service (crash) via a long PORT command.

CVE-2004-0346

Off-by-one buffer overflow in FTP server allows local users to gain privileges via a 1024 byte RETR command.

CVE-2004-0005

Multiple buffer overflows in chat client allow remote attackers to cause a denial of service and possibly execute arbitrary code.

CVE-2003-0356

Multiple off-by-one vulnerabilities in product allow remote attackers to cause a denial of service and possibly execute arbitrary code.

CVE-2001-1496

Off-by-one buffer overflow in server allows remote attackers to cause a denial of service and possibly execute arbitrary code.

+8 more examples

Applicable Platforms

C
Not Language-Specific

Security Training

Train your team to recognize and prevent security threats with our comprehensive security awareness program.

Start Training

Vulnerability Scanning

Discover vulnerabilities in your applications and infrastructure before attackers do.

Scan Now