1919
Nature Type ID Name Page
ParentOf 1114 Inappropriate Whitespace Style 1953
ParentOf 1115 Source Code Element without Standard Prologue 1954
ParentOf 1116 Inaccurate Comments 1955
ParentOf 1117 Callable with Insufficient Behavioral Summary 1957
Weakness Ordinalities
Indirect :
Demonstrative Examples
Example 1:
The usage of symbolic names instead of hard-coded constants is preferred.
The following is an example of using a hard-coded constant instead of a symbolic name.
Example Language: C (Bad)
char buffer[1024];
...
fgets(buffer, 1024, stdin);
If the buffer value needs to be changed, then it has to be altered in more than one place. If the
developer forgets or does not find all occurrences, in this example it could lead to a buffer overflow.
Example Language: C (Good)
enum { MAX_BUFFER_SIZE = 1024 };
...
char buffer[MAX_BUFFER_SIZE];
...
fgets(buffer, MAX_BUFFER_SIZE, stdin);
In this example the developer will only need to change one value and all references to the buffer
size are updated, as a symbolic name is used instead of a hard-coded constant.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 1412 Comprehensive Categorization: Poor Coding Practices 1400 2538
CWE-1079: Parent Class without Virtual Destructor Method
Weakness ID : 1079
Structure : Simple
Abstraction : Base
Description
A parent class contains one or more child classes, but the parent class does not have a virtual
destructor method.
Extended Description
This issue can prevent the product from running reliably due to undefined or unexpected behaviors.
If the relevant code is reachable by an attacker, then this reliability problem might introduce a
vulnerability.
CWE Version 4.14
CWE-1080: Source Code File with Excessive Number of Lines of Code
CWE-1080: Source Code File with Excessive Number of Lines of Code