---
title: "CWE-464: Addition of Data Structure Sentinel"
url: https://radicalnotion.ai/cwe/cwe-464
type: cwe
description: "The accidental addition of a data-structure sentinel can cause serious programming logic problems."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-464: Addition of Data Structure Sentinel

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 2
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The accidental addition of a data-structure sentinel can cause serious programming logic problems.

Data-structure sentinels are often used to mark the structure of data. A common example of this is the null character at the end of strings or a special sentinel to mark the end of a linked list. It is dangerous to allow this type of control data to be easily accessible. Therefore, it is important to protect from the addition or modification of sentinels.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Modify Application Data | Generally this error will cause the data structure to not work properly by truncating the data. |

## Potential mitigations

### Implementation, Architecture and Design

Encapsulate the user from interacting with data sentinels. Validate user input to verify that sentinels are not present.

### Implementation

Proper error checking can reduce the risk of inadvertently introducing sentinel values into data. For example, if a parsing function fails or encounters an error, it might return a value that is the same as the sentinel.

### Architecture and Design

Use an abstraction library to abstract away risky APIs. This is not a complete solution.

### Operation

Use OS-level preventative functionality. This is not a complete solution.

## Demonstrative examples

### Example 1

The following example assigns some character values to a list of characters and prints them each individually, and then as a string. The third character value is intended to be an integer taken from user input and converted to an int. The first print statement will print each character separated by a space.

Bad code:

```c
char *foo;
foo=malloc(sizeof(char)*5);
foo[0]='a';
foo[1]='a';
foo[2]=fgetc(stdin);
foo[3]='c';
foo[4]='\0';
printf("%c %c %c %c %c \n",foo[0],foo[1],foo[2],foo[3],foo[4]);
printf("%s\n",foo);
```

However, if a NULL byte is read from stdin by fgetc, then it will return 0. When foo is printed as a string, the 0 at character foo\[2\] will act as a NULL terminator, and the second printf() statement will not print foo\[3\].

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-38246 | bnxt: properly flush XDP redirect lists | critical | 9.8 | - | No | 2025-07-09 |
| CVE-2022-48786 | vsock: remove vsock from connected table when connect is interrupted by a signal | high | 7.8 | - | No | 2024-07-16 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-138](https://radicalnotion.ai/cwe/cwe-138) | Improper Neutralization of Special Elements |
| Peer | [CWE-170](https://radicalnotion.ai/cwe/cwe-170) | Improper Null Termination |
| Peer | [CWE-463](https://radicalnotion.ai/cwe/cwe-463) | Deletion of Data Structure Sentinel |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Addition of data-structure sentinel | - | - |
| CERT C Secure Coding | Do not inadvertently truncate a null-terminated byte string | STR03-C | - |
| CERT C Secure Coding | Do not assume that strtok() leaves the parse string unchanged | STR06-C | - |

## Frequently asked questions

### What is CWE-464?

The accidental addition of a data-structure sentinel can cause serious programming logic problems.

### What CVEs are caused by CWE-464?

2 recorded CVEs are attributed to CWE-464, including CVE-2025-38246 and CVE-2022-48786.

### How do you prevent CWE-464?

Encapsulate the user from interacting with data sentinels. Validate user input to verify that sentinels are not present.

### What are the consequences of CWE-464?

Exploiting CWE-464 can lead to: Modify Application Data.

### Is CWE-464 actively exploited?

2 recorded CVEs are caused by CWE-464; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/464.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-464). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
