SEMICOL

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

1  void foo(){
2    for (i=0;i<10;i++);
3    {
4      do_this();
5    }
6  }

Klocwork flags line 2 for its suspiciously placed semicolon.

Security training

Application security training materials provided by Secure Code Warrior.