Skip to main content

CWE-193: CWE-193: Off-by-one Error

BaseStable

Description

View on MITRE
Back to CWE Lookup

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
Languages
Platforms
Languages

Frequently Asked Questions

What is CWE-193: CWE-193: Off-by-one Error?+

CWE-193: CWE-193: Off-by-one Error is a Common Weakness Enumeration (CWE) entry maintained by MITRE. Description

What are the security consequences of CWE-193: Off-by-one Error?+

If exploited, CWE-193 (CWE-193: Off-by-one Error) it can compromise DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory) and DoS: Instability, leading to outcomes such as Scope: Availability This 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., Scope: Integrity If 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 and further memory corruption may occur..

How do you prevent or mitigate CWE-193: Off-by-one Error?+

Recommended mitigations for CWE-193 include: 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().

Which programming languages are affected by CWE-193: Off-by-one Error?+

CWE-193 commonly affects Languages. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-193 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More