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 |
Tags
- 알뜰요금제
- xml뷰어
- 유니콘
- 알뜰
- 유니콘광고차단
- applestore
- productivity Power Tools
- 광고차단
- 유심무료
- 알뜰유심
- OPENDART
- SK7MOBILE
- XML무료뷰어
- VS2019
- 유니콘앱
- vs2017
- xmlviewer
- json #paramquery
- 금융감독원API
- advil
- 애드빌
- apple여의도
- 소스비교
- #알뜰폰
- VS2015
- AWS
- 애드빌용법
- VLOOKUP
- 여의도IFC
- IFC
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 |