audit_value_needs_encoding(3)

audit_value_needs_encoding3

Check a string to see if it needs encoding

Usage

#include <libaudit.h>

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

Overview

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

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

Releases

3 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12–13
  2. Arch

Author

Steve Grubb

From audit 4.2.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.