From: Kevin Day Date: Fri, 9 Oct 2026 00:27:34 +0000 (-0500) Subject: Update: Ensure f_fll_id_t.name is always NULL terminated. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8b2791ed56bf818ea47bf82f66b819b6d535fabc;p=fll Update: Ensure f_fll_id_t.name is always NULL terminated. Set the normal length of `f_fll_id_name_length_d` to 63. Then have the actual max length remain at 64 via newly added `f_fll_id_name_max_length_d`. The `f_fll_id_name_length_d` is only used for comparisons now. The `f_fll_id_name_max_length_d` is used on the structure. This should prevent **API** and **ABI** breakage. Add missing close parenthesis in documentation comment. --- diff --git a/level_0/f_type/c/type/fll.h b/level_0/f_type/c/type/fll.h index 26de31930..3e333a0a6 100644 --- a/level_0/f_type/c/type/fll.h +++ b/level_0/f_type/c/type/fll.h @@ -22,12 +22,12 @@ extern "C" { * This was originally designed for FSS (Featureless Settings Specification) but has been expanded to be used by the entire project. * * An FLL Identifier consists of two parts: - * 1) A 64-byte long string representing a machine-name for the type. + * 1) A 64-byte long string representing a machine-name for the type, where the last byte (the 64th byte) must always be NULL. * 2) A 16-bit digit representing 2^16 possible type classifications, which is representeed by 4 hexadecial 1-byte strings for text. * * For example "fss-1234" is a valid type such that: * 1) name: "fss". - * 2) type: "1234", (or 0x1 in binary. + * 2) type: "1234", (or 0x1 in binary). * * UTF-8 codes are available, but one must consider that 1 4-byte characte still takes up 4-bytes. * Therefore for all 4-byte UTF-8 characters, there is a maximum of 16 characters available. @@ -40,16 +40,20 @@ extern "C" { * * The name must only be "word" characters (therefore "-" is not allowed). * + * The f_fll_id_name_length_d defines the length of non-NULL characters and the f_fll_id_name_max_length_d must always be 1 byte longer than f_fll_id_name_length_d. + * This allows for the f_fll_id_t.name to be guaranteed to always be a NULL terminated when properly managed. + * * Properties: * - name: The string representing the name of the FLL Identifier (This is not a NULL terminated string). * - type: The code representing the type of the Identifier. * - used: A representation of how many bytes in name are in used (if 0, then there is no name, thus this can be seen as not a valid identifier). */ #ifndef _di_f_fll_id_t_ - #define f_fll_id_name_length_d 64 + #define f_fll_id_name_length_d 63 + #define f_fll_id_name_max_length_d (f_fll_id_name_length_d + 1) typedef struct { - char name[f_fll_id_name_length_d]; + char name[f_fll_id_name_max_length_d]; uint16_t type; uint8_t used;