CS.CONSTCOND.WHILE

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

Example 1

Copy
  class Something {
      void DoSomething() {
          while (false) {    // defect
              /* ... */
          }
          while (true) {     // Ok - typical usage of 'do' constructs when a user to organize an infinite loop
              /* ... */
          }
      }
 }

Security training

Application security training materials provided by Secure Code Warrior.