total amount of memory that must be allocated.
Replace unbounded copy functions with analogous functions that support length
arguments, such as strcpy with strncpy. Create these if they are not available.
Use sizeof() on the appropriate data type to avoid CWE-467.