.\" File automatically generated by doxy2man0.3 .\" Generation date: Thu Sep 3 2026 .TH radcli_avp_get_cstr 3 2026-09-03 "radcli" "Radius client library" .SH "NAME" radcli_avp_get_cstr \- Read an attribute's value as a NUL-terminated string, with no allocation or copy. .SH SYNOPSIS .nf .B #include .sp \fBconst char * radcli_avp_get_cstr\fP( \fBconst radcli_avp *\fP\fIa\fP ); .fi .SH DESCRIPTION .PP Meaningful for RADCLI_TYPE_STRING and RADCLI_TYPE_TEXT attributes, but 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. Returns NULL, rather than a silently short string, if the value contains an embedded NUL byte before its real end (logged at LOG_WARNING): a server-supplied value of e.g. "admin\0attacker" must not be readable back as the trusted string "admin" by any caller that treats this return value as the whole attribute. 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). .PP 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) 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, whose bytes never went through add-side validation. RADCLI_TYPE_STRING attributes have no such requirement: NUL-checked only, like every other type. .SH PARAMETERS .TP .B a the attribute. .SH RETURN VALUE .PP 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. .SH SEE ALSO .PP .nh .ad l \fIradcli_avp_add_bytes\fP(3), \fIradcli_avp_add_bytes_by_num\fP(3), \fIradcli_avp_add_gigawords64\fP(3), \fIradcli_avp_add_gigawords64_by_num\fP(3), \fIradcli_avp_add_ip4\fP(3), \fIradcli_avp_add_ip4_by_num\fP(3), \fIradcli_avp_add_ip4prefix\fP(3), \fIradcli_avp_add_ip4prefix_by_num\fP(3), \fIradcli_avp_add_ip6\fP(3), \fIradcli_avp_add_ip6_by_num\fP(3), \fIradcli_avp_add_str\fP(3), \fIradcli_avp_add_str_by_num\fP(3), \fIradcli_avp_add_uint32\fP(3), \fIradcli_avp_add_uint32_by_num\fP(3), \fIradcli_avp_add_uint64\fP(3), \fIradcli_avp_add_uint64_by_num\fP(3), \fIradcli_avp_add_username\fP(3), \fIradcli_avp_concat_str\fP(3), \fIradcli_avp_concat_str_by_num\fP(3), \fIradcli_avp_def\fP(3), \fIradcli_avp_get\fP(3), \fIradcli_avp_get_by_num\fP(3), \fIradcli_avp_get_bytes\fP(3), \fIradcli_avp_get_bytes_by_num\fP(3), \fIradcli_avp_get_cstr_by_num\fP(3), \fIradcli_avp_get_gigawords64\fP(3), \fIradcli_avp_get_gigawords64_by_num\fP(3), \fIradcli_avp_get_ip4prefix\fP(3), \fIradcli_avp_get_ip4prefix_by_num\fP(3), \fIradcli_avp_get_ip6\fP(3), \fIradcli_avp_get_ip6_by_num\fP(3), \fIradcli_avp_get_uint32\fP(3), \fIradcli_avp_get_uint32_by_num\fP(3), \fIradcli_avp_get_uint64\fP(3), \fIradcli_avp_get_uint64_by_num\fP(3), \fIradcli_avp_iter_next\fP(3), \fIradcli_avp_list_error\fP(3), \fIradcli_avp_list_free\fP(3), \fIradcli_avp_list_iter\fP(3), \fIradcli_avp_list_new\fP(3) .ad .hy