Event 2:
rand() returns a potentially dangerous value [
?potentially dangerous: the value cannot be determined and may come from program input].
- Determines the value that is cast in the Cast Alters Value warning later.
hide
Cast Alters Value
rand() is cast from
int to
unsigned char.
- rand() could be 256 or higher.
- Values 256 or higher cannot be stored as unsigned char. Casting them to unsigned char can cause data loss or sign change.
The issue can occur if the highlighted code executes.
See related event 2.
Show: All events | Only primary events