AUDIT_VALUE_NEEDS_ENCODING(3) Linux Audit API AUDIT_VALUE_NEEDS_ENCODING(3)

audit_value_needs_encoding - check a string to see if it needs encoding

#include <libaudit.h>
int audit_value_needs_encoding(const char *str, unsigned int size);

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.

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

audit_encode_nv_string(3), audit_encode_value(3).

Steve Grubb

May 2026 Red Hat