From: Alan T. DeKok Date: Thu, 20 Jul 2023 12:50:06 +0000 (-0400) Subject: define macro for automatically setting "safe" values X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81b22ebddeb57da859ee3a53fee82d3c24a09976;p=thirdparty%2Ffreeradius-server.git define macro for automatically setting "safe" values --- diff --git a/src/lib/util/value.h b/src/lib/util/value.h index 9d101130135..df9e7aa5378 100644 --- a/src/lib/util/value.h +++ b/src/lib/util/value.h @@ -165,6 +165,14 @@ struct value_box_s { ///< last for packing efficiency. }; +/** Macro to automatically define a value for the "safe" field based on the current module / library. + * + * Functions which escape tainted data can mark it "safe" for a + * particular purpose. Each module has it's own version of safety. + * e.g. LDAP, SQL, etc. Each module can then manage its own list of sub-types for safety. + */ +#define FR_VALUE_BOX_SAFE(_x) ((LOG_ID_LIB << 8) | _x) + /** @name List and cursor function definitions */ FR_DLIST_FUNCS(fr_value_box_list, fr_value_box_t, entry)