Suspiciously placed semicolon

The SEMICOL checker finds instances of misplaced semicolons. The parser may not recognize a misplaced semicolon in some situations, so Klocwork flags a semicolon on the same line as an if, for or while statement.

Vulnerability and risk

The misplaced semicolon is typically caused by programmer error, and can result in unexpected program behavior.

Vulnerable code example

  void foo(){
    for (i=0;i<10;i++);

Klocwork flags line 2 for its suspiciously placed semicolon.

Security training

Application security training materials provided by Secure Code Warrior.