CS.CONSTCOND.IF

The condition of an 'if' statement is always true or always false.

Example 1

1  class Thing {
2      void DoAction() {
3          if (sizeof(char) < 2)   // defect - the condition is constant
4          {
5              /* ... */
6          }
7      }
8  }

Security training

Application security training materials provided by Secure Code Warrior.