CS.CONSTCOND.WHILE

The condition of a 'while' statement is always true or always false.

Example 1

1  class Something {
2      void DoSomething() {
3          while (false) {    // defect
4              /* ... */
5          }
6          while (true) {     // Ok - typical usage of 'do' constructs when a user to organize an infinite loop
7              /* ... */
8          }
9      }
10 }

Security training

Application security training materials provided by Secure Code Warrior.