Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions EightBall.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.fortify.sca.plugins.maven.samples;

import java.io.FileReader;

public class EightBall {
public static void main(String args[]) throws Exception {

Check notice

Code scanning / Fortify SCA

J2EE Bad Practices: Leftover Debug Code Low

The class EightBall contains debug code, which can create unintended entry points in a deployed web application. More information
char[] buffer = new char[1024];
String filename = args[0];
try {
filename = "" + (Integer.parseInt(filename) % 3);
} catch (Exception e) {
System.out.println("Invalid input.");
}
new FileReader(filename).read(buffer);

Check failure

Code scanning / Fortify SCA

Path Manipulation High

Attackers can control the file system path argument to FileReader() at EightBall.java line 14, which allows them to access or modify otherwise protected files. More information

Check failure

Code scanning / Fortify SCA

Unreleased Resource: Streams High

The function main() in EightBall.java sometimes fails to release a system resource allocated by FileReader() on line 14. More information

Check notice

Code scanning / Fortify SCA

Unchecked Return Value Low

The method main() in EightBall.java ignores the value returned by read() on line 14, which could cause the program to overlook unexpected states and conditions. More information

Check notice

Code scanning / Fortify SCA

Path Manipulation Low

Attackers can control the file system path argument to FileReader() at EightBall.java line 14, which allows them to access or modify otherwise protected files. More information
System.out.println(buffer);
}
}