You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

System_Information_Leak.java 753 B

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package System_Information_Leak;
  2. import java.io.IOException;
  3. import java.util.logging.Logger;
  4. public class System_Information_Leak
  5. {
  6. static final Logger log = Logger.getLogger("local-logger");
  7. public void bad() throws IOException{
  8. String val = "1";
  9. try{
  10. int value = Integer.parseInt(val);
  11. if (value != 0) {
  12. log.info("parse ok");
  13. }
  14. }catch(NumberFormatException e){
  15. e.printStackTrace(); // bad 系统信息泄露
  16. }
  17. }
  18. public void good() {
  19. String val = "1";
  20. try{
  21. int value = Integer.parseInt(val);
  22. if (value != 0) {
  23. log.info("parse ok");
  24. }
  25. }catch(NumberFormatException e){
  26. log.info("NumberFormatException");
  27. }finally{
  28. log.info("complete"); // good 系统信息泄露
  29. }
  30. }
  31. }

No Description

Contributors (1)