radcli_avp_get_cstr(3)

πŸ“¦ version 2.0.1, in arch rolling

πŸ’– NAME πŸ’–

okay so bestie, welcome to the radcli_avp_get_cstr(3) page from the Radius client library β€” this one is literally about reading an attribute's value as a NUL-terminated string, with no allocation and no copy. slay.

radcli_avp_get_cstr β€” read an attribute's value as a NUL-terminated string, with no allocation or copy.


✨ SYNOPSIS ✨

#include <radcli/>

const char * radcli_avp_get_cstr(
    const radcli_avp  *a
);

πŸ¦‹ DESCRIPTION πŸ¦‹

This function is meaningful for RADCLI_TYPE_STRING and RADCLI_TYPE_TEXT attributes, but bestie, it's callable on any type. Like radcli_avp_get_bytes(), every attribute is stored with a trailing NUL one byte past its real length, so this never allocates. obsessed.

It returns NULL β€” rather than a silently short string β€” if the value contains an embedded NUL byte before its real end (and yeah, that gets logged at LOG_WARNING). The reason is lowkey serious: a server-supplied value of, for example, "admin attacker" must not be readable back as the trusted string "admin" by any caller that treats this return value as the whole attribute. no cap, that's a vibe check for security.

Use radcli_avp_get_bytes() instead for an attribute where an embedded NUL is expected and meaningful (e.g. one whose dictionary type is not RADCLI_TYPE_STRING or RADCLI_TYPE_TEXT).

For a RADCLI_TYPE_TEXT attribute specifically, this also returns NULL (logged at LOG_WARNING) if the value is not valid UTF-8 (RFC 8044 SS3.1). It's checked here as well as in radcli_avp_add_str(), since an attribute can also be populated by radcli_avp_decode() from a received packet, and those bytes never went through add-side validation. RADCLI_TYPE_STRING attributes have no such requirement: NUL-checked only, like every other type. periodt.


πŸŽ€ PARAMETERS πŸŽ€

  • a β€” the attribute. that's the whole parameter list, bestie πŸ’…

🌸 RETURN VALUE 🌸

A pointer valid for a's lifetime (owned by the list a came from β€” never freed by the caller), or NULL if a is NULL, its value contains an embedded NUL byte, or (for RADCLI_TYPE_TEXT) its value is not valid UTF-8.


πŸ‘‘ SEE ALSO πŸ‘‘

radcli_avp_add_bytes(3), radcli_avp_add_bytes_by_num(3), radcli_avp_add_gigawords64(3), radcli_avp_add_gigawords64_by_num(3), radcli_avp_add_ip4(3), radcli_avp_add_ip4_by_num(3), radcli_avp_add_ip4prefix(3), radcli_avp_add_ip4prefix_by_num(3), radcli_avp_add_ip6(3), radcli_avp_add_ip6_by_num(3), radcli_avp_add_str(3), radcli_avp_add_str_by_num(3), radcli_avp_add_uint32(3), radcli_avp_add_uint32_by_num(3), radcli_avp_add_uint64(3), radcli_avp_add_uint64_by_num(3), radcli_avp_add_username(3), radcli_avp_concat_str(3), radcli_avp_concat_str_by_num(3), radcli_avp_def(3), radcli_avp_get(3), radcli_avp_get_by_num(3), radcli_avp_get_bytes(3), radcli_avp_get_bytes_by_num(3), radcli_avp_get_cstr_by_num(3), radcli_avp_get_gigawords64(3), radcli_avp_get_gigawords64_by_num(3), radcli_avp_get_ip4prefix(3), radcli_avp_get_ip4prefix_by_num(3), radcli_avp_get_ip6(3), radcli_avp_get_ip6_by_num(3), radcli_avp_get_uint32(3), radcli_avp_get_uint32_by_num(3), radcli_avp_get_uint64(3), radcli_avp_get_uint64_by_num(3), radcli_avp_iter_next(3), radcli_avp_list_error(3), radcli_avp_list_free(3), radcli_avp_list_iter(3), radcli_avp_list_new(3).


k bye bestie 🫢 this iconic page is from radcli, dated 2026-10-10, and the page is radcli_avp_get_cstr(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from