AUDIT\_VALUE\_NEEDS\_ENCODING(3) Linux Audit API AUDIT\_VALUE\_NEEDS\_ENCODING(3)

# [NAME](#NAME)

audit\_value\_needs\_encoding - check a string to see if it needs encoding

# [SYNOPSIS](#SYNOPSIS)

```
#include <libaudit.h>
```

```
int audit_value_needs_encoding(const char *str, unsigned int size);
```

# [DESCRIPTION](#DESCRIPTION)

**audit\_value\_needs\_encoding**() checks *size* bytes from *str* to see if the value must be encoded before it is logged in an audit name/value field. Specifically, this function checks for a double-quote, any byte in the range 0x00 through 0x20, or any byte in the range 0x7F through 0xFF. The 0x00 through 0x20 range includes C0 control bytes and space.

*str* is the byte string to check. It does not have to be NUL-terminated and may contain embedded NUL bytes. *size* is the number of bytes to check from *str*. If *str* is NULL, encoding is not needed.

# [RETURN VALUE](#RETURN_VALUE)

The return value if encoding is needed is 1. If not needed is 0.

# [SEE ALSO](#SEE_ALSO)

[**audit\_encode\_nv\_string**(3)](/man/os/audit/audit_encode_nv_string.3), [**audit\_encode\_value**(3)](/man/os/audit/audit_encode_value.3).

# [AUTHOR](#AUTHOR)

Steve Grubb

May 2026 Red Hat

---

Document: audit_value_needs_encoding(3) from audit 4.2.1-r1 (Chainguard OS)
Source: https://github.com/linux-audit/audit-userspace
