MITRE D3FENDdefensive technique
D3-VI Variable Initialization
- Tactic
- Harden
Definition
Setting variables to a known value before use.
How it works
How it Works
Initializing variables upon declaration ensures that the variable has a known quantity before use.
Considerations
• Default behavior when declaring variables varies by language.
• This is particularly important in programming languages that do not initialize variables to a default value upon declaration. In these instances, the value that a variable will contain after declaration is indeterminate which can cause issues. In fact, that value could be different each time the program is ran.
• Note: This resource should not be considered a definitive or exhaustive coding guideline.
Related
Counters · MITRE ATT&CK (2)
Child of · MITRE D3FEND (1)
- D3-SCH Source Code Hardening defensive technique
References
- https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Integer-Types Integer Initialization in C
- https://cwe.mitre.org/data/definitions/457.html CWE-457: Use of Uninitialized Variable