371
Description
The product does not correctly calculate the length of strings that can contain wide or multi-byte
characters.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 682 Incorrect Calculation 1499
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 133 String Errors 2310
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Integrity
Confidentiality
Availability
Execute Unauthorized Code or Commands
This weakness may lead to a buffer overflow. Buffer
overflows often can be used to execute arbitrary code,
which is usually outside the scope of a program's implicit
security policy. This can often be used to subvert any other
security service.
Availability
Confidentiality
Read Memory
DoS: Crash, Exit, or Restart
DoS: Resource Consumption (CPU)
DoS: Resource Consumption (Memory)
Out of bounds memory access will very likely result in the
corruption of relevant memory, and perhaps instructions,
possibly leading to a crash. Other attacks leading to lack of
availability are possible, including putting the program into
an infinite loop.
Confidentiality Read Memory
In the case of an out-of-bounds read, the attacker may
have access to sensitive information. If the sensitive
information contains system details, such as the current
buffers position in memory, this knowledge can be
used to craft further attacks, possibly with more severe
consequences.
Detection Methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST),
can find some instances of this weakness by analyzing source code (or binary/compiled code)
without having to execute it. Typically, this is done by building a model of data flow and control
flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input)
CWE Version 4.14
CWE-135: Incorrect Calculation of Multi-Byte String Length
CWE-135: Incorrect Calculation of Multi-Byte String Length