Example 61 Detecting endian dependent code fragments
Consider the following code fragment.
union Endian { char c[4]; int v;
};
In such cases, cadvise generates the following warning:
"endian1.c", line 2: warning
union Endian {
^
The +wendian option can catch various potential endian dependent data structures and usage. It helps you to locate potential problem spots while porting from
8.5 Detecting potential security vulnerabilities
The +wsecurity[=1234] option enables compile time diagnostic messages for potential security vulnerabilities. This option is useful in an environment where you are not trained to detect security vulnerabilities.
With the +wsecurity option, warnings are generated for cases where untrusted (tainted) data may reach a critical reference point in the program. This is based on
The problems detected include use of unsafe APIs, use of unsafe data length argument, unsafe loop exit condition, unsafe file path use, and so on.
For example, see the reference to untrusted file path in the following code: