Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- #알뜰폰
- vs2017
- VS2015
- AWS
- 알뜰요금제
- 유니콘
- advil
- OPENDART
- productivity Power Tools
- 애드빌용법
- IFC
- SK7MOBILE
- xml뷰어
- 소스비교
- 애드빌
- 알뜰
- 유니콘앱
- applestore
- VLOOKUP
- 유니콘광고차단
- 금융감독원API
- apple여의도
- 여의도IFC
- 알뜰유심
- 광고차단
- xmlviewer
- 유심무료
- json #paramquery
- XML무료뷰어
- VS2019
Archives
- Today
- Total
체크개발자's Blog
Prevent Path Manipulation in Java 본문
//Path manipulation 방지
public static String FilePathFilter(String FilePath)
{
String result = FilePath;
if(!"".equals(File))
{
FilePath= FilePath.replace('\\', '/'); // 시스템에 따라 file.separator 다르기때문에 java는 '/' 로 설정해야한다.
FilePath= FilePath.replaceAll("\\\\", "/");
FilePath= FilePath.replaceAll("/[.]{1,2}", ""); //상위경로로 가는 것을 방지
FilePath = FilePath.replaceAll("\\[.]{1,2}", ""); //상위경로로 가는 것을 방지
result = FilePath.replaceAll("&", "");
}
return result;
}
'프로그래밍 > JAVA' 카테고리의 다른 글
| [Eclips] Author 단축키 (0) | 2017.11.18 |
|---|---|
| AES/CBC/PKCS5Padding (0) | 2017.08.23 |
| [Spring] 스프링 파일업로드/ file upload/ 파일업로드 한글깨짐 (0) | 2017.08.07 |
| [javascript] 현재 날짜 가져오기 (0) | 2017.07.21 |
| [JAVA] AES128 CBC 암복호화 예제 (0) | 2017.07.14 |
Comments