audit_encode_value(3)

audit_encode_value3

Encode bytes as an ascii hexadecimal string

Usage

#include <libaudit.h>

char *audit_encode_value(char *final, const char *buf, unsigned int size);

Overview

audit_encode_value() encodes size bytes from buf as an uppercase ASCII hexadecimal string. Each input byte is written as two hexadecimal digits. The input does not have to be NUL-terminated and may contain embedded NUL bytes.

final is the caller-provided output buffer. It must be at least 2 * size + 1 bytes long to hold the encoded value and its terminating NUL byte. size is the number of bytes to encode from buf, not necessarily the result of strlen(3).

If buf is NULL, audit_encode_value() writes an empty string to final.

e.g.: "foo bar" is encoded as "666F6F20626172". "\1\2\3\4" is encoded as "01020304".

Return value

Returns final on success. If final is NULL, NULL is returned.

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.