CS.CONSTCOND.TERNARY

The condition of a conditional expression is always true or always false.

Example 1

1  class IntSize {
2      void GetIntSize() {
3          return (sizeof(int) > 4 ? sizeof(int) : 4);  // defect - the condition is constant
4      }
5  }

Security training

Application security training materials provided by Secure Code Warrior.