Skip to content

VNX-824: Access of Uninitialized Pointer

Reports a C or C++ local pointer declared without an initialiser whose first mention in the function dereferences it (*p, p->f, p[i], strcpy(p, ...), memset(p, ...), delete p) before anything stores an address in it.

Updated 02 Nov 2026Checked against cli@de9b52a
Field Value
Rule ID VNX-824
Severity Low
SARIF level note
Kind sast
Languages C, C++
CWE CWE-824
CAPEC CAPEC-66
ATT&CK T1190
CWSS vector CWSS:1.0/TI:L/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:L/DI:H/EX:L/EC:N/P:L
Tags access-of-uninitialized-pointer cwe-824 c cpp memory-safety
Source internal/sast/rules/vnx-824.rego

Overview

VNX-824 maps to CWE-824: Access of Uninitialized Pointer. It reports a local pointer declared without an initialiser (char *p;, struct node *n;, std::string *s;) whose first mention in the same function, within 40 lines, dereferences it: *p, p->field, p[i], a buffer argument of strcpy/strncpy/strcat/memcpy/memmove/memset/sprintf/snprintf/fgets/gets/read/recv/fread/strlen/strcmp/printf/puts/free, or delete p.

Not reported: a first mention that assigns the pointer (p = malloc(...), for (p = head; ...), if ((p = f()) == NULL)), takes its address (getaddrinfo(..., &res), getline(&line, ...)), or only tests it; pointers with an initialiser; static, extern and file-scope pointers (zero-initialised); struct, union and class members; K&R parameter declarations and lines that continue an expression from the line above; declarations listing several pointers; flow through other functions; comments and string literals. Uninitialised scalars and arrays are VNX-457.

Why This Matters

An uninitialised local pointer holds whatever the stack held before. Writing through it corrupts an arbitrary address; reading through it leaks or crashes. Because the stale value depends on earlier calls, the bug often works in tests and fails in production.

What Gets Flagged

char *p;
strcpy(p, who);          /* FLAGGED: p was never given an address */

struct node *n;
n->value = value;        /* FLAGGED */

Remediation

  1. Initialise every pointer at its declaration (char *p = NULL;) and assign it a real object before use.
  2. Allocate or point at a buffer before copying into it.

References

Suppressing this rule

Put a nosec comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file’s language (#, //, -- or ;):

# nosec vnx-824
// nosec vnx-824

Or record an ignore rule: vulnetix ignore add --rule vnx-824 --reason "...". See Suppressing findings.

Edit this pageSources: cli/internal/sast/rules/vnx-824.rego, cli/internal/sast/docs/vnx-824.md
esc
↑ ↓ move↵ openSearches in your browser. A key like autonomy.max or a code like threshold_required jumps straight to it.