-
Notifications
You must be signed in to change notification settings - Fork 0
add eightball #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 { | ||
| 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 failureCode 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 failureCode 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 noticeCode 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 noticeCode 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); | ||
| } | ||
| } | ||
Check notice
Code scanning / Fortify SCA
J2EE Bad Practices: Leftover Debug Code Low