...
In this example, p
is incremented and then dereferenced, . However, *p
has no effect.
Code Block | ||
---|---|---|
| ||
int *p; /* ... */ *p++; |
...
Code Block | ||
---|---|---|
| ||
int *p;
/* ... */
(*p)++
|
Compliant Solution (memory mapped devices)
Another possibility is that p
is being using to reference a memory-mapped device. In this case, the variable p
should be declared as volatile
.
Code Block | ||
---|---|---|
| ||
volatile int *p; /* ... */ (void) *p++; |
Risk Assessment
The presence of code that has no effect could indicate logic errors that may result in unexpected behavior and vulnerabilities.
...