 
                            ...
| Code Block | ||||
|---|---|---|---|---|
| 
 | ||||
| const size_t String_Size = 20;
struct node_s {
  struct node_s* next;
  char* name;
}
 | 
Exceptions
API01-C-EX1: Using a string before sensitive data such as pointers is permitted when it is not practical to segregate the strings from the sensitive data.
...
| Code Block | ||||
|---|---|---|---|---|
| 
 | ||||
| const size_t String_Size = 20;
struct node_s {
  struct node_s* next;
  char name[String_Size];
}
struct node_s list[10];
 | 
...
Risk Assessment
Failure to follow this recommendation can result in memory corruption from buffer overflows, which can easily corrupt data or yield remote code execution.
| Rule | Severity | Likelihood | Detectable | Repairable | Priority | Level | 
|---|---|---|---|---|---|---|
| API01-C | High | Likely | Yes | No | P18 | L1 | 
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée | 
 | array_out_of_bounds field_overflow_upon_dereference | Supported | ||||||
| Parasoft C/C++test | 
BD-PB-OVERFWR,SECURITY-12
| 
 | CERT_C-API01-a | Avoid overflow when writing to a buffer |