...
Code Block | ||
---|---|---|
| ||
enum { MAX_TABLE_SIZE = 256 }; int create_table(size_t size) { size_t table_size; char **table; if (size == 0 || size > MAX_TABLE_SIZE) { /* Handle invalid size */ } /* * The wrap check has been omitted based on the assumption that * MAX_TABLE_SIZE * sizeof(char *) cannot exceed SIZE_MAX * If this assumption is not valid, a check must be added */ assert(size <= SIZE_MAX/sizeof(char *)); table_size = size * sizeof(char *); table = malloc(table_size); if (table == NULL) { /* Handle error condition */ } /* ... */ return 0; } |
...
Wiki Markup |
---|
\[[Seacord 05|AA. C References#Seacord 05]\] Chapter 5, "Integer Security" |
...
INT03-A. Use a secure integer library 04. Integers (INT) INT05-A. Do not use input functions to convert character data if they cannot handle all possible inputs