
...
In a hosted environment, the main function receives a third argument, char *envp[], that points to a null-terminated array of pointers to char, each of which points to a string that provides information about the environment for this execution of the program (5.1.2.3.2).
...
Using the envp
environment pointer after the environment has been modified can result in undefined behavior.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
---|---|---|---|---|---|---|
ENV31-C | Low | Probable | Yes | NoMedium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Astrée |
| Supported | |||||||
Compass/ROSE | |||||||||
Cppcheck Premium | 24.9.0 | premium-cert-env31-c | |||||||
Helix QAC |
| DF4991, DF4992, DF4993 | |||||||
LDRA tool suite |
| 118 S | Fully Implemented | ||||||
Parasoft C/C++test |
| CERT_C-ENV31-a | Do not rely on an environment pointer following an operation that may invalidate it | ||||||
| CERT C: Rule ENV31-C | Checks for environment pointer invalidated by previous operation (rule fully covered) |
...