AUDIT_VALUE_NEEDS_ENCODING(3)
π AUDIT_VALUE_NEEDS_ENCODING(3) π
ok bestie so this is a page from the Linux Audit API, and today's main character is audit_value_needs_encoding β she's the one who checks a string to see if it needs encoding. yes that's literally the whole job and she does it flawlessly, no notes β¨
β¨ NAME β¨
audit_value_needs_encoding β check a string to see if it needs encoding π΅οΈβοΈ
πΈ SYNOPSIS πΈ
#include <libaudit.h>
int audit_value_needs_encoding(const char *str, unsigned int size);
π¦ DESCRIPTION π¦
okay so here's the vibe. audit_value_needs_encoding() looks at size bytes starting from str and tells you whether that value has to be encoded before it gets logged in an audit name/value field. like, before it goes out into the world, does it need a little makeover first? π
specifically β and this is the part you gotta remember β she's checking for:
- a double-quote π
- any byte in the range
0x00through0x20 - any byte in the range
0x7Fthrough0xFF
and just so we're clear, that 0x00 through 0x20 range is including the C0 control bytes and the plain old space. yeah. space counts. she's picky like that, and honestly? iconic. π
π the arguments π
strβ the byte string you want checked. lowkey the important part: it does not have to be NUL-terminated, and it's totally fine if it has embedded NUL bytes in there. she's not scared of a\0bestie. and ifstrisNULL? then encoding is not needed, simple as that. β¨sizeβ the number of bytes to check starting fromstr. that's it, that's the whole thing. π’
π RETURN VALUE π
1β yep, encoding is needed π0β nope, encoding is not needed π«Ά
π₯ SEE ALSO π₯
π AUTHOR π
Steve Grubb π
fr fr, that's the whole page. go encode responsibly bestie π§
Red Hat Β· May 2026 β mwah, ty for reading, ily, bye!! ππβ¨
π¦ where this page comes from
- arch rolling: audit 4.2.1-1 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 10: audit-libs-devel 4.2.1-3.el10 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- nixpkgs unstable: audit 4.2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms